|
发上源代码:
#include "iostream.h"
#include "windows.h"
#include "stdio.h"
HWND hwnd;
HDC mdc,dc,cdc;
HBITMAP bp,temp,bgp,b[10];
int i = 0;
LRESULT CALLBACK WinSunProc(
HWND hwnd, // handle to window
UINT uMsg, // message identifier
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
);
int WINAPI WinMain(
HINSTANCE hInstance, // handle to current instance
HINSTANCE hPrevInstance, // handle to previous instance
LPSTR lpCmdLine, // command line
int nCmdShow // show state
)
{
WNDCLASS wc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
wc.hCursor = LoadCursor(NULL,IDC_ARROW);
wc.hIcon = LoadIcon(NULL,IDI_WINLOGO);
wc.hInstance = hInstance;
wc.lpfnWndProc = WinSunProc;
wc.lpszClassName = "Demo";
wc.lpszMenuName = NULL;
wc.style = CS_HREDRAW | CS_VREDRAW;
RegisterClass(&wc);
hwnd=CreateWindow("Demo","花",WS_OVERLAPPEDWINDOW & ~WS_MAXIMIZEBOX &~WS_THICKFRAME,
230,200,800,600,NULL,NULL,hInstance,NULL);
ShowWindow(hwnd,SW_SHOWNORMAL);
UpdateWindow(hwnd);
MSG msg;
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}
LRESULT CALLBACK WinSunProc(
HWND hwnd, // handle to window
UINT uMsg, // message identifier
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
)
{
switch(uMsg)
{
case WM_CREATE:
{
::SetTimer(hwnd,1,1000,NULL);
break;
}
case WM_PAINT:
{
// ::BitBlt(dc,0,0,800,600,mdc,0,0,SRCCOPY);
break;
}
case WM_TIMER:
{
::MessageBox(hwnd,"hello","sorry",0);
break;
}
case WM_CLOSE:
DestroyWindow(hwnd);
break;
case WM_DESTROY:
{
KillTimer(hwnd,1);
PostQuitMessage(0);
return 0;
}
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd,uMsg,wParam,lParam);
}
return 0;
}
好像按下CTRL+ALT+A,然后双击的时候会出现我所设定的消息框,然后就没了,最小化后,就开始一个个蹦出来了!
[em11] [em11] |
|