- UID
- 240
注册时间2005-3-4
阅读权限8
最后登录1970-1-1
初入江湖
该用户从未签到
|
发表于 2005-3-11 18:23:07
|
显示全部楼层
#include"windows.h"
#define VK_x 0x58
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdshow)
{if(!CreateMutex(NULL,TRUE,"No Previous Instance!"))
{MessageBox(NULL,"创建Mutex失败","NoPrev",MB_OK|MB_SYSTEMMODAL);
return FALSE;}
if(GetLastError()==ERROR_ALREADY_EXISTS)
{
MessageBox(NULL,"已有NoPrev的一个实例在运行,当前实例被终止境","NoPrev",MB_OK|MB_SYSTEMMODAL);
return FALSE;}
if(!RegisterHotKey(NULL,0x0001,MOD_CONTROL|MOD_SHIFT,VK_x))
{
MessageBox(NULL,"注册热键ctrl+shift+x失败","Noprev",MB_OK|MB_SYSTEMMODAL);
return FALSE;}
MessageBox(NULL,"NoPrev已启动!\n\n按下热键ctrl+shift+x将终止NoPrev.","NoPrev",MB_OK|MB_SYSTEMMODAL);
MSG msg;
while(GetMessage(&msg,NULL,0,0))
{switch (msg.message)
{case WM_HOTKEY:
if (int(msg.wParam)==0x0001)
if(MessageBox(NULL,"终止NoPrev?","NoPrev",MB_OK|MB_SYSTEMMODAL)==IDYES)
return true;}}
return true;}
怎样调试这个程序呢?????????? |
|