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

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

时间:2009-12-30 15:42来源:未知 作者:admin 点击:
分享到:
MaskBits|=ALTBIT; break; case VK_CONTROL: MaskBits|=CTRLBIT; break; case VK_SHIFT: MaskBits|=SHIFTBIT; break; default: //judge the key and send message break; } for(int index=0;index { if(hCallWnd[ind
     MaskBits|=ALTBIT;
     break;
    case VK_CONTROL:
     MaskBits|=CTRLBIT;
     break;
    case VK_SHIFT:
     MaskBits|=SHIFTBIT;
     break;
    default: //judge the key and send message
     break;
   }
   for(int index=0;index   {
    if(hCallWnd[index]==NULL)
     continue;
    if(IsWindow(hCallWnd[index])&&(HotKey[index]==wParam)&&(HotKeyMask[index]==MaskBits))
    {
     SendMessage(hCallWnd[index],WM_HOTKEY,wParam,WM_KEYDOWN);
     bProcessed=TRUE;
    }
   }
  }
  if(!bProcessed){
   for(int index=0;index    if(hCallWnd[index]==NULL)
     continue;
    if(IsWindow(hCallWnd[index])&&(HotKey[index]==0)&&(HotKeyMask[index]==0))
     SendMessage(hCallWnd[index],WM_HOTKEY,WM_HOTKEY,lParam);
   }
  }
 }
 return CallNextHookEx( hHook, nCode, wParam, lParam );
}

BOOL InitHotkey()
{
 if(hHook!=NULL){
  nHookCount++;
  return TRUE;
 }
 else
  hHook=SetWindowsHookEx(WH_KEYBOARD,(HOOKPROC)KeyboardProc,hins,0);
  if(hHook!=NULL)
   nHookCount++;
 return (hHook!=NULL);
}
BOOL UnInit()
{
 if(nHookCount>1){
  nHookCount--;
 return TRUE;
}
BOOL unhooked = UnhookWindowsHookEx(hHook);
 if(unhooked==TRUE){
  nHookCount=0;
  hHook=NULL;
 }
 return unhooked;
}

BOOL __declspec(dllexport) __stdcall AddHotkey(HWND hWnd,UCHAR cKey,UCHAR cMask)
{
 BOOL bAdded=FALSE;
 for(int index=0;index  if(hCallWnd[index]==0){

精彩图集

赞助商链接