どっちで勉強するか悩んでます…
#include<windows.h>
#define APP_NAME TEXT("Sample_MainWindow")
LRESULT CALLBACK WindowProc (
HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
) {
int iMsgID;
switch(uMsg) {
case WM_DESTROY:
PostQuitMessage(0);
return 0;
case WM_CREATE:
iMsgID = MessageBox(
NULL , TEXT("ウィンドウを生成しますか?") ,
((LPCREATESTRUCT)lParam)->lpszName , MB_YESNO
);
return (iMsgID == IDYES ? 0 : -1);
}
return DefWindowProc(hWnd , uMsg , wParam , lParam);
}
int WINAPI WinMain(
HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR lpCmdLine, int nCmdShow
) {
WNDCLASS wc;
MSG msg;
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = WindowProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(NULL , IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL , IDC_ARROW);
wc.hbrBackground = (HBRUSH)COLOR_BACKGROUND + 1;
wc.lpszMenuName = NULL;
wc.lpszClassName = APP_NAME;
if (!RegisterClass(&wc)) return 0;
if (CreateWindow(
APP_NAME , TEXT("WM_CREATE Sample") ,
WS_OVERLAPPEDWINDOW | WS_VISIBLE,
CW_USEDEFAULT , CW_USEDEFAULT,
CW_USEDEFAULT , CW_USEDEFAULT,
NULL , NULL , hInstance , NULL
) == NULL) return 0;
while(GetMessage(&msg , NULL , 0 , 0) > 0) {
DispatchMessage(&msg);
}
return msg.wParam;
}
よろしくお願いします…