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:
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. :)
By placing the IsWindowVisible and getClassName check inside the loop, and break when true, I managed to do it. :)
精彩评论