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
|
#include <windows.h>
long __stdcall WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
if(message==WM_DESTROY)
PostQuitMessage(0);
else
return DefWindowProc(hwnd, message, wParam, lParam);
return 0;
}
int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrev, LPSTR lpszArgument, int nCmdShow)
{
char szClassName[ ] = "CodeBlocksWindowsApp";
MSG messages;
WNDCLASS wc;
HWND hwnd;
wc.hInstance = hInstance, wc.lpszClassName = szClassName;
wc.lpfnWndProc = WindowProcedure, wc.style = 0;
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION), wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.lpszMenuName = NULL, wc.cbClsExtra = 0;
wc.cbWndExtra = 0, wc.hbrBackground = (HBRUSH)COLOR_BACKGROUND;
RegisterClass(&wc);
hwnd=CreateWindow(szClassName,"Template",WS_OVERLAPPEDWINDOW,50,50,544,375,HWND_DESKTOP,NULL,hInstance,NULL);
ShowWindow (hwnd, nCmdShow);
while(GetMessage (&messages, NULL, 0, 0))
{
TranslateMessage(&messages);
DispatchMessage(&messages);
}
return messages.wParam;
}
|