龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > 软件开发 > VC开发 >

用Visual C++实现屏幕抓程序(6)

时间:2009-12-30 15:42来源:未知 作者:admin 点击:
分享到:
hCallWnd[index]=hWnd; HotKey[index]=cKey; HotKeyMask[index]=cMask; bAdded=TRUE; KeyCount++; break; } } return bAdded; } BOOL __declspec(dllexport) __stdcall DeleteHotkey(HWND hWnd,UCHAR cKey,UCHAR cMa
   hCallWnd[index]=hWnd;
   HotKey[index]=cKey;
   HotKeyMask[index]=cMask;
   bAdded=TRUE;
   KeyCount++;
   break;
  }
 }
 return bAdded;
}

BOOL __declspec(dllexport) __stdcall DeleteHotkey(HWND hWnd,UCHAR cKey,UCHAR cMask)
{
 BOOL bRemoved=FALSE;
 for(int index=0;index  if(hCallWnd[index]==hWnd){
   if(HotKey[index]==cKey&&HotKeyMask[index]==cMask){
    hCallWnd[index]=NULL;
    HotKey[index]=0;
    HotKeyMask[index]=0;
    bRemoved=TRUE;
    KeyCount--;
    break;
   }
  }
 }
 return bRemoved;
}

void VerifyWindow()
{
 for(int i=0;i  if(hCallWnd[i]!=NULL){
   if(!IsWindow(hCallWnd[i])){
    hCallWnd[i]=NULL;
    HotKey[i]=0;
    HotKeyMask[i]=0;
    KeyCount--;
   }
  }
 }
}

BOOL CHookApp::InitInstance()
{
 AFX_MANAGE_STATE(AfxGetStaticModuleState());
 hins=AfxGetInstanceHandle();
 InitHotkey();
 return CWinApp::InitInstance();
}

int CHookApp::ExitInstance()
{
 VerifyWindow();
 UnInit();
 return CWinApp::ExitInstance();
}

精彩图集

赞助商链接