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
|
LRESULT CALLBACK WinProc(HWND p_hWindow, UINT message, WPARAM wParam, LPARAM lParam)
{
static HWND buttons[2] = {NULL};
PAINTSTRUCT ps;
RECT rcWindowSize;
int iwidthButton, iheightButton, y_button, x_button,test;
switch (message)
{
case WM_CREATE:
return 0;
case WM_PAINT:
HDC hDC;
iwidthButton = 70;
iheightButton = 20;
InvalidateRect(p_hWindow,NULL,true);
y_button = g_windowSize.cy - iheightButton - 35;
x_button = g_windowSize.cx - iwidthButton - 15;
buttons[0] = CreateWindowEx(WS_EX_WINDOWEDGE,
"BUTTON",
"Cancel",
WS_CHILD | WS_VISIBLE,
x_button,
y_button,
iwidthButton,
iheightButton,
p_hWindow,
(HMENU)ID_QUITBUTTON,
NULL,
NULL);
buttons[1] = CreateWindowEx(WS_EX_WINDOWEDGE,
"BUTTON",
"Launch",
WS_CHILD | WS_VISIBLE,
x_button - iwidthButton - 10,
y_button,
iwidthButton,
iheightButton,
p_hWindow,
(HMENU)ID_LAUNCHAPPLICATION,
NULL,
NULL);
hDC = BeginPaint(p_hWindow,&ps);
//je draw tous les autres éléments.
EndPaint(p_hWindow,&ps);
return 0;
case WM_SIZE:
GetWindowRect(p_hWindow,&rcWindowSize);
g_windowSize.cx = rcWindowSize.right - rcWindowSize.left;
g_windowSize.cy = rcWindowSize.bottom - rcWindowSize.top;
DestroyWindow(buttons[0]);
DestroyWindow(buttons[1]);
InvalidateRect(p_hWindow,NULL,true);
return 0;
case WM_DESTROY:
GetWindowRect(p_hWindow,&g_interactionWindowPosition);
//PostQuitMessage(0);
return 0; |
Partager