WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Window Manipulation

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Detecting Owner or Parent Window


Question:

I am trying to identify the owner/parent of the MSN Messenger window that one uses to type in/receive messages without success.

I am selecting the MSN Messenger 'Conversation' window. I then hit a 'hot-key' combo to trigger my script. The script uses DllHwnd with WinGetActive to get the handle.

WinGetActive correctly identifies the window. It advises the correct title 'Fred - Conversation' and a 'Class' of 'IMWindowClass'.

Using cWndInfo with both parameters 3 and 9 - they both return a '0'. i.e. that the 'conversation' window does not have an 'owner/parent'....

ActiveWindow = WinGetActive() ;get name of 'active window'
active_window_handle=DllHwnd(ActiveWindow) ;get 'handle'
active_window_class=cWndInfo(active_window_handle,2) ;get 'class'

Is_There_Owner_handle = cWndInfo(active_window_handle,9)

Is_There_Parent_handle = cWndInfo(active_window_handle,3)
WITH MSN MESSENGER 'CONVERSATION WINDOW' THESE BOTH RETURN '0'

Answer:

I would suspect it is a top level window, having no owner or parent. There is not guarantee that there is a parent-child relationship w/respect to windows themselves. Typically, a child window is contained within the frame of the parent window, which is what you see in the typical MDI [Multiple Document Interface] windows application. The WinBatch studio is an example of an MDI app, where each open document is a child window owned by and contained within the frame of the parent window.

Since MSN Messenger opens separate windows for each chat session, there's probably no parent-child relationship at the window level. Each window may be a top-level window. However, what isn't clear is whether or not the MSN Messenger uses a single process [with multiple threads] to handle all of the windows or if it creates separate processes running their own .EXE files to handle all of the windows. I think it runs it all in one multi-threaded process.

Anyway, there is no guarantee that because you click on a widget in one window to launch another window that they are related. Nor is there any guarantee that the parent of the launching widget is related to the launched window. The only necessary connection between a launched and launching window it that user input to one window may cause the appearance of the other.


Article ID:   W16749
File Created: 2005:02:18:12:22:14
Last Updated: 2005:02:18:12:22:14