The part I want to focus on is the function SetActiveWND() at the top of my code. According to http://msdn.microsoft.com/en-us/library/ms646311(VS.85).aspx,The SetActiveWindow function activates a window. The window must be attached to the calling thread's message queue.
I have done that with the function AttachThreadInput(http://msdn.microsoft.com/en-us/library/cc429027.aspx) that is mentioned by the MSDN documentation. However, if you compile the source, the SetActiveWND() always fails, and the window that gets unhidden is never set as the active window, just the foreground window. Any advice?
I have no idea why, the variable "next" isn't null, but if I try to do anything with it, it doesn't work. I tried using ShowWindow(next,SW_HIDE); just to see if it would work, and it didn't. But when I inserted an If statement under next=GetWindow(hwnd[i],GW_HWNDNEXT); to check if "next" is null, it said it wasn't.
Any other ideas?
Marc G
April 6th, 2009, 02:05 AM
I would suggest to use Spy++. Put a breakpoint or a message after the GetWindow statement. Check the value of next and use Spy++ to find out which window that exactly is and whether it's the correct window that you actually really want.
shadowx360
April 9th, 2009, 05:43 PM
I just tried using Spy++, and the handles GetWindow() returns cannot be found with their finder tool, but by searching I see the handles belong to the same process as the next window, so I believe those are child windows. The window caption of the hwnd returned by GetWindow is "M", and is owned by "Default IME", according to Spy++. What is this window? I see many instances of this window called "M," and is used in many different classes and applications, and includes classes like scroll bar. How can I find the whole entire next window, not just the scroll bar?
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.