dll注入远程线程后,在DllMain中的 DLL_PROCESS_ATTACH 下注册热键F3失败
代码如下:DWORD destId, currentId=GetCurrentProcessId();
HWND hwnd;
do
{
hwnd=FindWindow(NULL, "目标进程");
GetWindowThreadProcessId(hwnd, &destId);
} while (destId!=currentId && hwnd!=NULL);
if (hwnd!=NULL)
{
DWORD hotId=GlobalAddAtom("test_f3");
int result=RegisterHotKey(hwnd, hotId, 0, VK_F3);
result=GetLastError();
}GetLastError得到的是1408 无效的窗口句柄 或者不是同一个线程
窗口句柄hwnd 我觉得是有效的 因为我还有对hwnd的其他操作 比如PostMessage 这些都是成功的
所以我就想问问大家 如果是在dll中 这个RegisterHotKey到底怎么用呢?
代码如下:DWORD destId, currentId=GetCurrentProcessId();
HWND hwnd;
do
{
hwnd=FindWindow(NULL, "目标进程");
GetWindowThreadProcessId(hwnd, &destId);
} while (destId!=currentId && hwnd!=NULL);
if (hwnd!=NULL)
{
DWORD hotId=GlobalAddAtom("test_f3");
int result=RegisterHotKey(hwnd, hotId, 0, VK_F3);
result=GetLastError();
}GetLastError得到的是1408 无效的窗口句柄 或者不是同一个线程
窗口句柄hwnd 我觉得是有效的 因为我还有对hwnd的其他操作 比如PostMessage 这些都是成功的
所以我就想问问大家 如果是在dll中 这个RegisterHotKey到底怎么用呢?
远程注入dll中注册热键
http://blog.csdn.net/whatday/article/details/8001966