C 全域性鍵盤監視

2021-08-22 15:14:49 字數 1540 閱讀 4192

public class interceptkeys

//wh_journalrecord   = 0;  

//wh_journalplayback = 1;  

//wh_keyboard        = 2;  

//wh_getmessage      = 3;  

//wh_callwndproc     = 4;  

//wh_cbt             = 5;  

//wh_sysmsgfilter    = 6;  

//wh_mouse           = 7;  

//wh_hardware        = 8;  

//wh_debug           = 9;  

//wh_shell           = 10;

//wh_foregroundidle  = 11;

//wh_callwndprocret  = 12;

//wh_keyboard_ll     = 13;

//wh_mouse_ll        = 14;

///

/// 解除安裝鉤子

///

/// 鉤子的控制代碼

///

[dllimport("user32.dll", charset = charset.auto, setlasterror = true)]

[return: marshalas(unmanagedtype.bool)]

private static extern bool unhookwindowshookex(intptr hhk);

[dllimport("user32.dll", charset = charset.auto, setlasterror = true)]

private static extern intptr callnexthookex(intptr hhk, int ncode, intptr wparam, intptr lparam);

[dllimport("kernel32.dll", charset = charset.auto, setlasterror = true)]

private static extern intptr getmodulehandle(string lpmodulename);

#endregion

///

/// 安裝鉤子

///

public static void sethook()

}///

/// 處理函式

///

///

///

///

///

/// 如果返回1,則結束訊息,這個訊息到此為止,不再傳遞;

/// 如果返回0或呼叫callnexthookex函式則訊息出了這個鉤子繼續往下傳遞,也就是傳給訊息真正的接受者;

///

private static intptr hookcallback(int ncode, intptr wparam, intptr lparam)}}

c 全域性鍵盤鉤子

using system using system.collections.generic using system.text using system.windows.forms using system.runtime.interopservices using system.diagnosti...

C 全域性鍵盤監聽

using system using system.collections.generic using system.text using system.runtime.interopservices using system.windows.forms using system.reflectio...

C 全域性鍵盤獲取元件

keyshoot.csusing system using system.collections.generic using system.componentmodel using system.diagnostics using system.linq using system.text usin...