1.首先引入System.Runtime.InteropServices
using System.Runtime.InteropServices;
2.在类内部声明两个API函数,它们的位置和类的成员变量等同.
[System.Runtime.InteropServices.DllImport("user32.dll")] //申明API函数
public static extern bool RegisterHotKey(
IntPtr hWnd, // handle to window
int id, // hot key identifier
uint fsModifiers, // key-modifier options
Keys vk // virtual-key code
);
[System.Runtime.InteropServices.DllImport("user32.dll")] //申明API函数
public static extern bool ...
[ 查看全文 ]