Delphi如何获取QQ2010聊天窗口句柄?
2011-02-25 15:35
477 查看
unit HKProc; interface uses Windows, Messages,Dialogs,iniFiles,SysUtils; var hNextHookProc: HHook; procSaveExit: Pointer; function CBTProc(iCode: Integer; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall; function EnableHotKeyHook: BOOL; export; function DisableHotKeyHook: BOOL; export; implementation function CBTProc(iCode: Integer; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall; var p: PCBTActivateStruct; begin result:= 0; If iCode <0 Then begin Result := CallNextHookEx(hNextHookProc, iCode, wParam, lParam); Exit; end else begin If iCode = HCBT_ACTIVATE then begin p:= PCBTActivateStruct(lParam); if (p.hWndActive = findwindow( '#32770 ',nil)) then showmessage( 'lkjl '); end; end; end; function EnableHotKeyHook: BOOL; export; begin Result := False; if hNextHookProc <> 0 then Exit; hNextHookProc := SetWindowsHookEx(WH_CBT,CBTProc,HInstance,0); Result := hNextHookProc <> 0; end; function DisableHotKeyHook: BOOL; export; begin if hNextHookProc <> 0 then begin UnhookWindowshookEx(hNextHookProc); hNextHookProc := 0; end; Result := hNextHookProc = 0; end; end. If iCode = HCBT_ACTIVATE then begin p:= PCBTActivateStruct(lParam); p.hWndActive//就是激活窗口的句柄。findwindow( '#32770 ',nil)返回的是QQ聊天窗口的句柄 end;
http://zhidao.baidu.com/question/168272170.html?fr=qrl&cid=868&index=1&fr2=query
相关文章推荐
- Delphi如何获取QQ2010聊天窗口句柄?
- Delphi 获取其他程序窗口句柄
- Delphi 通得进程ID获取主窗口句柄
- Delphi获取其它进程窗口句柄的3种方法
- Delphi获取其它进程窗口句柄的3种方法
- Process 后, 如何获取打开窗口的句柄(根据进程句柄获取窗口句柄)
- 如何获取本窗口句柄
- 如何根据进程id获取该进程的主窗口句柄
- 关闭窗口函数及如何获取窗口句柄(VC)
- 如何获取控制台窗口句柄 (HWND)
- MFC 如何获取各类窗口的句柄并用PostMessage发送消息
- Delphi获取其它进程窗口句柄的3种方法
- 在java程序中如何能获取到另一个程序的windows句柄,又如何使用这个句柄向这个窗口发送消息
- 如何获取控制台窗口句柄 (HWND)
- Delphi通过IE窗口句柄获取网页接口(IWebBrowser2) good
- Delphi获取其它进程窗口句柄的3种方法
- Delphi获取其它进程窗口句柄的3种方法
- 如何获取控制台窗口句柄 (HWND)
- Delphi获取其它进程窗口句柄的3种方法
- 转:VC:如何根据文件名来获取程序进程和窗口句柄的代码(转载)