Bonjour,
J'ai réalisé une application (ou du moins posé les premières fondations) avec l'API Windows.
Je souhaiterais créer une fenêtre "popu" qui s'afficherait après avoir cliqué sur un item du menu.
Ci-dessous le pseudo code avec quelques détails sur les fonctions _child :
J'aimerais que la fenêtre soit modeless et complétement découplée de la fenêtre principale.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
85
86
87 int WINAPI wWinMain(...) { MyInitCommonControls(); MyRegisterClass(hInst); // avec WindowProc InitInstance(hInst, nCmdShow); MessageLoop(); } LRESULT CALLBACK WindowProc(...) { switch (uMsg) { ... case WM_COMMAND: { witch (LOWORD(wParam)) { ... CASE IDM_MENU_TEST: { MyRegisterClass_child(hInst); // avec WindowProc_child - j'ignore si je dois enregistrer toutes les classes dans wWinMain InitInstance_child(hInst, nCmdShow); MessageLoop_child() } ... } } ... } } LRESULT CALLBACK WindowProc_child(...) { switch (uMsg) { ... } } //----------------------------------------------- ATOM MyRegisterClass_child(hInst) { WNDCLASSEX wcex = { }; wcex.cbSize = sizeof(WNDCLASSEX); wcex.style = CS_HREDRAW | CS_VREDRAW; //CS_DBLCLKS; // CS_HREDRAW | CS_VREDRAW; // UNIT style wcex.lpfnWndProc = EditProc; // WNDPROC // int cbClsExtra // int cbWndExtra wcex.hInstance = hInst; // HINSTANCE wcex.hbrBackground = (HBRUSH)COLOR_BTNSHADOW; // HCURSOR hCursor // HBRUSH hbrBackground // LPCSTR lpzMenuName wcex.lpszClassName = CHILD_WINDOW_CLASS; // LPCSTR return RegisterClassEx(&wcex); } HWND InitInstance_child(hInst, nCmdShow) { HWND hwnd_child = CreateWindowEx ( NULL, CHILD_WINDOW_CLASS, L"Child window", WS_SIZEBOX | WS_CLIPSIBLINGS,//WS_CHILD | WS_POPUP | WS_VISIBLE, 225, 65, 150, 24, NULL, NULL, hInst, NULL ); return hwnd_child; }
Pouvez-vous me confirmer le pattern ci-dessous et m'aider à la corriger ?
Merci par avance !![]()
Partager