• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

How to GetClassName

Hi,
Can someone please help with the following problem:
I launch an application let's say notepad,exe with CreateProcess and call EnumWindows. within the EnumWindows procedure I call GetWindowThreadProcessId for the hWnd and compare it to the process ID retrieved from CreateProces, if it matches I call GetClassName. But it doesn't work. EnumWindows does not return a process ID identical to the one from CreateProces

Thanks.
 
Just looking real quick at my own usage of GetWindowThreadProcessId and I noticed that the process ID has both a return value and a out parameter. Are you using the return value rather than the out parameter? If that is not the issue, could you record the two values and use the command line program "tasklist" to find out if both values are legitimate process Ids?

Here is my method signature for GetWindowThreadProcessId in C#:

[DllImportAttribute("user32.dll", EntryPoint = "GetWindowThreadProcessId")]
public static extern int GetWindowThreadProcessId(IntPtr hWnd, out int processId);
 
Just looking real quick at my own usage of GetWindowThreadProcessId and I noticed that the process ID has both a return value and a out parameter. Are you using the return value rather than the out parameter? If that is not the issue, could you record the two values and use the command line program "tasklist" to find out if both values are legitimate process Ids?

Here is my method signature for GetWindowThreadProcessId in C#:

[DllImportAttribute("user32.dll", EntryPoint = "GetWindowThreadProcessId")]
public static extern int GetWindowThreadProcessId(IntPtr hWnd, out int processId);

Hi and thanks
Well I just got it working accidentally. what I did was pass the dwThreadId of CreateProcess as lParam to EnumWindows and use the direct return value (eax) of GetWindowThreadProcessId to check against lParam and now it works.
Thanks anyway.
 
Back
Top