0

Whenever Skype is in Default View, the TConversationWindow's become children of the tSkMainForm Window.

I am having problems finding out which TConversationWindow is active - however it's not like an MDI interface - only one TConversationWindow is visible, like if it was a Tab/Page.

When I do GetForegroundWindow, Skype's MainForm handle is returned (tSkMainForm). Is there any way that I can get the foreground TConversationWindow within Skype?

This question of mine has screenshots of Skype's Default View, if you need it. :)

EDIT: Here is a screenshot of the Winspector Hierachy:

enter image description here

EDIT2: I tried going thru the windows like this:

procedure TForm1.Button1Click(Sender: TObject);
  function GetClassName(Handle: HWND): String;
  var
  Buffer: array[0..MAX_PATH] of Char;
  begin
  Windows.GetClassName(Handle, @Buffer, MAX_PATH);
  Result := String(Buffer);
  end;
Var
 Wnd: HWND;
 SkypeWnd: HWND;
begin
 SkypeWnd := FindWindow('tSkMainForm',nil);

 Wnd := GetTopWindow(SkypeWnd);

 while (GetClassName(Wnd) <> 'TConversationForm') and (Wnd <> 0) and (not IsWindowVisible(Wnd)) do
 begin
   Wnd := GetNextWindow(Wnd,GW_HWNDNEXT);
 end;

 Label1.Caption := GetClassName(Wnd)+' - '+GetHandleText(wnd);

end;

The above is supposed to find the visible window, however when I debug it, it never enters the Begin End within the While loop, and Label1 displays "TChromeMenu - ChromeToolbar". When I remove the IsWindowVisible check, it atleast finds a TConversationForm. What am I doing wrong?

EDIT3: By placing the IsWindowVisible and getClassName check inside the loop, and break when true, I managed to do it. :)

15
  • 1
    What about EnumerateWindows or FindWindow to get it? Jul 1, 2011 at 12:39
  • I think you have to use z-order of the child windows to determine which one is on top.
    – ain
    Jul 1, 2011 at 12:42
  • There is no such function "EnumerateWindows", FindWindow is not applicable here too. Best bet is GetWindow(.., GW_HWNDFIRST) call. Jul 1, 2011 at 12:47
  • @David - FindWindow and FindWindowEx does not return the expected TConversationWindow. How would EnumWindows help me in this situation? @ain - How would I do that? :)
    – Jeff
    Jul 1, 2011 at 12:48
  • @Downvoter - The first parameter, would that be the parent window?
    – Jeff
    Jul 1, 2011 at 12:51

1 Answer 1

0

By placing the IsWindowVisible and getClassName check inside the loop, and break when true, I managed to do it. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.