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
|
LRESULT CALLBACK MessageProcedure(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
static int X = 250;
static int Y = 250;
HINSTANCE hInstance;
hInstance = LoadLibrary (TEXT("Application01.exe"));
switch(message)
{
case WM_CREATE:
int MessageBoxID;
MessageBoxID = MessageBox(hWnd, TEXT(" Are ya ready kids?"), TEXT("Are ya ready kids?"),
MB_ICONQUESTION | MB_YESNO);
if (MessageBoxID == IDNO)
{
PostQuitMessage(0);
}
if (MessageBoxID == IDYES)
{
UpdateWindow(hWnd);
}
case WM_PAINT:
HICON hIcon;
hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1));
HDC handleDeviceContext;
PAINTSTRUCT PaintSt;
handleDeviceContext = BeginPaint(hWnd, &PaintSt);
DrawIcon(handleDeviceContext, X, Y, hIcon);
EndPaint(hWnd, &PaintSt);
break;
case WM_KEYDOWN:
switch(wParam)
case VK_LEFT:
X -= 5;
InvalidateRect(hWnd, NULL, TRUE);
break;
case VK_RIGHT:
X += 5;
InvalidateRect(hWnd, NULL, TRUE);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc (hWnd, message, wParam, lParam);
}
return 0;
}
| |