沉默,去学学API吧,当你学完他以后,你就会发现,做坏事实在是太容易了,
而做好一件事就.........看看下面代码吧,你学过了就很轻松写出来了.
#include<windows.h>
LRESULTCALLBACKWndProc(HWND,UINT,WPARAM,LPARAM);
intWINAPIWinMain(HINSTANCEhInstance,HINSTANCEhPrevInstance,PSTRszCmdLine,intiCmdShow)
{
staticTCHARszAppName[]="god";
MSGmsg;
WNDCLASSwndclass;
HWNDhwnd;
wndclass.cbClsExtra=0;
wndclass.cbWndExtra=0;
wndclass.hbrBackground=NULL;
wndclass.hCursor=NULL;
wndclass.hIcon=NULL;
wndclass.hInstance=hInstance;
wndclass.lpfnWndProc=WndProc;
wndclass.lpszClassName=szAppName;
wndclass.lpszMenuName=NULL;
RegisterClass(&wndclass);
hwnd=CreateWindow(szAppName,"god",WS_OVERLAPPEDWINDOW,0,0,GetSystemMetrics(SM_CXSCREEN),
GetSystemMetrics(SM_CYSCREEN),NULL,NULL,hInstance,NULL);
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
returnmsg.wParam;
}
LRESULTCALLBACKWndProc(HWNDhwnd,UINTmessage,WPARAMwParam,LPARAMlParam)
{
switch(message)
{
caseWM_QUERYENDSESSION:
SendMessage(hwnd,WM_ENDSESSION,0,0);
return0;
}
而做好一件事就.........看看下面代码吧,你学过了就很轻松写出来了.
#include<windows.h>
LRESULTCALLBACKWndProc(HWND,UINT,WPARAM,LPARAM);
intWINAPIWinMain(HINSTANCEhInstance,HINSTANCEhPrevInstance,PSTRszCmdLine,intiCmdShow)
{
staticTCHARszAppName[]="god";
MSGmsg;
WNDCLASSwndclass;
HWNDhwnd;
wndclass.cbClsExtra=0;
wndclass.cbWndExtra=0;
wndclass.hbrBackground=NULL;
wndclass.hCursor=NULL;
wndclass.hIcon=NULL;
wndclass.hInstance=hInstance;
wndclass.lpfnWndProc=WndProc;
wndclass.lpszClassName=szAppName;
wndclass.lpszMenuName=NULL;
RegisterClass(&wndclass);
hwnd=CreateWindow(szAppName,"god",WS_OVERLAPPEDWINDOW,0,0,GetSystemMetrics(SM_CXSCREEN),
GetSystemMetrics(SM_CYSCREEN),NULL,NULL,hInstance,NULL);
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
returnmsg.wParam;
}
LRESULTCALLBACKWndProc(HWNDhwnd,UINTmessage,WPARAMwParam,LPARAMlParam)
{
switch(message)
{
caseWM_QUERYENDSESSION:
SendMessage(hwnd,WM_ENDSESSION,0,0);
return0;
}