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
|
#ifndef UNICODE
#define UNICODE
#endif
#include "stdafx.h"
#include "windows.h"
WNDCLASS a;
long _stdcall myfunc(HWND,UINT,UINT,LONG);
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
HWND h;
MSG m;
a.hInstance=hInstance;
a.lpszClassName="my";
//a.hIcon=(struct HICON__ *)1;
a.lpfnWndProc=myfunc;
a.hbrBackground=(struct HBRUSH__ *)GetStockObject(COLOR_BACKGROUND|COLOR_INACTIVEBORDER);
RegisterClass(&a);
h=CreateWindow("my","title",WS_OVERLAPPEDWINDOW,20,20,300,200,0,0,hInstance,0);
ShowWindow(h,1);
while(GetMessage(&m,0,0,0))
DispatchMessage(&m);
return 0;
}
long _stdcall myfunc(HWND w,UINT x,UINT y,LONG z)
{
switch(x)
{
/* case WM_DESTROY:
PostQuitMessage(0);
break;*/
case WM_CLOSE:
if(MessageBox(w,"Really want to quit?","Quit",MB_OKCANCEL)==IDOK)
{
DestroyWindow(w);
}
else return 0;
default:
return DefWindowProc(w,x,y,z);
}
return 0;
}
|