I would like to add an application to it. I am using SetWindowsHookEx and I can create a system hook, but I want to create a hook for a specific application. I need to have the thread id of the target application to connect it to. I know the name of the window, I know the name of exe, and from them I can get the window handle and process ID, but how to get the thread ID? I saw a message on how to do this in C # , but I don't see how to get a list of threads in C ++.
HWND windowHandle = FindWindow(NULL, _T("SomeOtherApp")); DWORD processId = GetWindowThreadProcessId(windowHandle, NULL); DWORD threadId = ??? // How do I get thread id here? HHOOK hook = ::SetWindowsHookEx( WH_CBT, HookCBTProc, hInst, threadId);
Thank you, Alexander.
source share