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
|
#include <Windows.h>
#include "resource.h"
LRESULT CALLBACK WinProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam);
INT WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hprevInstance,LPSTR lpCmdLine,int nShowCmd)
{
char AddCaption[40];
MSG Msg;
HWND HWnd;
WNDCLASSEX WndClsEx;
LPCTSTR ClsName = L"BasicApp";
LPCTSTR WndName = L"Cafeteria Shooting";
LoadString(hInstance,IDS_APP_NAME,LPWSTR(AddCaption), 40);
WndClsEx.cbSize = sizeof(WNDCLASSEX);
WndClsEx.style = CS_HREDRAW || CS_VREDRAW;
WndClsEx.cbClsExtra = 0;
WndClsEx.cbWndExtra = 0;
WndClsEx.lpszClassName = ClsName;
WndClsEx.lpszMenuName = MAKEINTRESOURCE(IDR_MAINFRAME);
WndClsEx.lpfnWndProc = WinProc;
WndClsEx.hCursor = LoadCursor(hInstance,MAKEINTRESOURCE(IDC_CURSOR1));
WndClsEx.hIcon = LoadIcon(hInstance,MAKEINTRESOURCE(IDI_ICON1));
WndClsEx.hIconSm = LoadIcon(hInstance,MAKEINTRESOURCE(IDI_ICON1));
WndClsEx.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
WndClsEx.hInstance = hInstance;
RegisterClassEx(&WndClsEx);
HWnd = CreateWindow(ClsName,LPWSTR(AddCaption),WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,NULL,NULL,hInstance,NULL);
if(!HWnd)
return 0;
ShowWindow(HWnd,SW_SHOWNORMAL);
UpdateWindow(HWnd);
while(GetMessage(&Msg,NULL,0,0))
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
return Msg.wParam;
}
LRESULT CALLBACK WinProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
switch(uMsg)
{
case WM_DESTROY:
PostQuitMessage(WM_QUIT);
break;
default:
return DefWindowProc(hWnd,uMsg,wParam,lParam);
}
return 0;
}
|