VC中函数GetFocus可以,函数原型是:HWND GetFocus(VOID);
翻译成C#是:
[DllImport("user32.dll", EntryPoint = "GetFocus")]public static extern int GetFocus();
PS: MSDN 的解释:The GetFocus function retrieves the handle to the window that has the keyboard focus, if the window is attached to the calling thread's message queue.
[DllImport("user32.dll", EntryPoint = "WindowFromPoint")]
public static extern int WindowFromPoint(int xPoint, int yPoint);
比如说这两行就是c#中完整的的使用API函数获取鼠标指向的窗口的句柄的用法。
要求按照这种格式给出代码,如何使用API函数实现按键精灵里面的GetKeyFocusWnd命令,不要说尝试FindWindow或者GetForegroundWindow等等,就必须要实现GetKeyFocusWnd这个获取键盘当前焦点的窗口。
要代码的啊!