// 5fskdl.cpp : Defines the entry point for the application.
//
#include "window.h"
HINSTANCE hinstance;
HINSTANCE ghInst;
char* szAppName="SimleAPI";//注册窗口类
int CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
ghInst=hInstance;
HWND ghWnd=NULL;
MSG msg;
WNDCLASS wc;
wc.cbClsExtra=0;
wc.cbWndExtra=0;
wc.hbrBackground=(HBRUSH)GetStockObject(GRAY_BRUSH);//HBRUSH:HBRUSH Handle to a brush.
wc.hCursor=LoadCursor(NULL,IDC_ARROW);
wc.hIcon=LoadIcon(NULL,IDI_APPLICATION);
wc.hInstance=hInstance;
wc.lpfnWndProc=WndProc;
wc.lpszClassName=szAppName;
wc.lpszMenuName=NULL;
wc.style=CS_HREDRAW|CS_VREDRAW;
RegisterClass(&wc);
ghWnd=CreateWindow(szAppName,"李子文",WS_OVERLAPPEDWINDOW,10,10,150,120,NULL,hInstance,NULL);
if(!ghWnd)
{
return 0;
}
ShowWindow(ghWnd,nCmdShow);
UpdateWindow(ghWnd);
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
// TODO: Place code here.
return 0;
}
int CALLBACK WndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
{
switch(message)
{
case WM_CREATE:
MessageBox(GetFocus()/*父窗口*/,"呵呵","TITLE??",WM_OK|WM_INFORMATION);break;
case WM_LBUTTON:
MessageBox(GetFocus(),"WM_LBUTTON","WM_BUTTON",WM_OK|WM_CANCEL);
break;
case WM_DESTROY:
MessageBox(GetFocus(),"WM_DESTROY","WM_DESTROY",WM_OK|WM_CANCEL);
PostQuitMessage(0);
break;
default:return DefWindowProc(hwnd,message,wParam,lParam);
}
return false;
}