@Koschi, @BlueCobold
Ich danke euch vielmals, konnte auf jeden Fall schon viele neue Sachen lernen, auch wenn sie mein Problem
noch nicht behoben haben
Könnte eventuell ein Fehler im WndProc sein, weil in allen anderen Funktionen entdecke ich keine Fehler.
Das Fenster erstellt es problemlos und er greift auch problemlos auf die Init Methode über den Konstruktor rüber und holt da
alle seine Informationen.
|
C-/C++-Quelltext
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
LRESULT CALLBACK wWindow::WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
LRESULT result = 0;
if (message == WM_CREATE)
{
LPCREATESTRUCT pcs = (LPCREATESTRUCT)lParam;
wWindow *pWindow = (wWindow *)pcs->lpCreateParams;
::SetWindowLongPtrW(
hwnd,
GWLP_USERDATA,
PtrToUlong(pWindow)
);
result = 1;
}
else
{
wWindow *pWindow = reinterpret_cast<wWindow *>(static_cast<LONG_PTR>(
::GetWindowLongPtrW(
hwnd,
GWLP_USERDATA)));
bool wasHandled = false;
if (pWindow)
{
switch (message)
{
case WM_COMMAND:
{
// If the user makes a selection from the list:
// Send CB_GETCURSEL message to get the index of the selected list item.
// Send CB_GETLBTEXT message to get the item.
// Display the item in a messagebox.
if (HIWORD(wParam) == CBN_SELCHANGE)
{
int ItemIndex = SendMessage((HWND)lParam, (UINT)CB_GETCURSEL,
(WPARAM)0, (LPARAM)0);
TCHAR ListItem[256];
(TCHAR)SendMessage((HWND)lParam,
(UINT)CB_GETLBTEXT,
(WPARAM)ItemIndex,
(LPARAM)ListItem);
// TODO:
// Do something after that
}
wasHandled = true;
result = 0;
} break;
// The WM_DISPLAYCHANGE message is sent to all windows when the display resolution has changed.
case WM_DISPLAYCHANGE:
{
InvalidateRect(hwnd, NULL, FALSE);
}
wasHandled = true;
result = 0;
break;
// Destroy the window
case WM_DESTROY:
{
PostQuitMessage(0);
}
wasHandled = true;
result = 1;
break;
}
}
if (!wasHandled)
{
result = DefWindowProc(hwnd, message, wParam, lParam);
}
}
return result;
}
|