zaryk
June 16th, 2009, 06:34 PM
Is there a way to check if a window has changed, other than periodically checking using Sleep() or alike functions? Something along the lines of how RegNotifyChangeKeyValue works?
|
Click to See Complete Forum and Search --> : C++ Winapi - Window Change zaryk June 16th, 2009, 06:34 PM Is there a way to check if a window has changed, other than periodically checking using Sleep() or alike functions? Something along the lines of how RegNotifyChangeKeyValue works? dc_2000 June 17th, 2009, 02:11 AM WHat do you mean by "window has changed"? If you mean window size and position, then you can call GetWindowRect() to get that. There's no need to use Sleep() though. If your program has a window, call SetTimer() with a periodic polling frequency (say, 1000 ms) and then process WM_TIMER messages where you can get window size by its handle. In case you need a more detailed changes you will have to set up a windows hook, SetWindowsHookEx() API and intercept & interpret all the messages that the window receives. Also note that this approach will work only if this window belongs to the same process ad the one monitoring its changes. If not, you will have to complicate it even more by injecting a DLL into that separate process to be able to set up a hook from there. JVene June 17th, 2009, 06:18 PM There's also the WM_RESIZE message, sent when the window had changed size (there are others). Are you referring to content on display? That gets tricky. Neandertal June 18th, 2009, 04:19 PM RegNotifyChangeKeyValue -> http://msdn.microsoft.com/en-us/library/ms724892(VS.85).aspx Check WM_SIZE, WM_SIZING, WM_MOVE, WM_MOVING and other related messages of the window. zaryk June 20th, 2009, 12:47 AM Oh sorry. For example, I need to know when an edit control changes its text. This edit control is of another program. I can already find the window using enumwindows and enumchild. I figured that if I were to be typing in the window, I would need a keyboard hook, but right now, my intentions are for an instant messenger....when someone sends me a message, and it is displayed in the edit control. ?? zaryk June 21st, 2009, 04:48 PM Guess...ill just have to hook it, and get all the messages. codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |