Delphi는 QQ2010 채팅창 핸들을 어떻게 가져옵니까?

2064 단어 Delphi
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

좋은 웹페이지 즐겨찾기