检测Skype是否处于“紧凑视图”状态或“默认视图”
我的应用程序的运行方式由 Skype 的视图模式决定,因为我的应用程序正在寻找类 TConversationWindow
的窗口,如果在默认视图中,该窗口是 tSkMainForm
的子级code>,并且如果在紧凑视图中,它不是 tSkMainForm
的子项。
这是我尝试做的:
Function IsCompactView:Boolean;
Var
Wnd : Hwnd;
Begin
Result := True;
Wnd := FindWindow('TConversationForm',nil);
if Wnd <> 0 then
begin
Wnd := GetParent(Wnd);
// Custom function that grabs the Window Text
if GetHandleText(Wnd) <> '' then
Result := False;
end;
End;
上面的函数将通过检查其父级是否有文本来查找顶级(除非我弄错了 - 没有窗口父级的窗口)TConversationForm
。如果 Skype 处于默认视图,则 TConversationForm
是 tSkMainForm
的子级,后者始终包含一些文本。它按预期工作。
现在解决实际问题:每当用户在两个视图之间切换时,顶级 TConversationForm
都不会“刷新”。它们消失了,但为了让它再次显示为 tSkMainForm 的子项(因此更改在 Winspector Spy 中可见),您必须在 Skype 中选择它,我不能依赖用户来做到这一点。
如果您不知道,这里是 2 个视图之间的区别:
紧凑视图
默认视图
如果您需要更多信息,请告诉我,谢谢!
The way my application functions, is determined by Skype's view mode, due to the fact that my application is looking for windows of class TConversationWindow
, which if in Default View is a child of tSkMainForm
, and if in Compact View, it is not a child of tSkMainForm
.
Here is what I tried to do:
Function IsCompactView:Boolean;
Var
Wnd : Hwnd;
Begin
Result := True;
Wnd := FindWindow('TConversationForm',nil);
if Wnd <> 0 then
begin
Wnd := GetParent(Wnd);
// Custom function that grabs the Window Text
if GetHandleText(Wnd) <> '' then
Result := False;
end;
End;
The above function will look for top-level (unless I am mistaken - the windows with no window parent) TConversationForm
's, by checking if their parent has text or not. If Skype is in Default View, the TConversationForm
's are children of tSkMainForm
, which always has some text. It works as it is supposed to.
Now for the actual problem: Whenever the user switches between the 2 views, the top-level TConversationForm
's are not "refreshed". They disappear alright, but in order for it to appear as a child of tSkMainForm
again (so the change is visible in Winspector Spy), you have to select it in Skype, and I cannot rely on the user to do that.
In case you dont know, here is the difference between the 2 views:
Compact View
Default View
If you need more info please let me know, thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不要使用 Windows 方法检测 Skype 是否处于“紧凑视图”或“默认视图”,而是尝试读取存储此类设置并通过“实时”更新的 config.xml 文件Skype。该文件位于
例如 Windows 7 中,这是该文件内部的位置
,存在一个名为
MultiWindowMode
的条目,这是
MultiWindowMode
的 Xpath 位置的值该条目的“1”表示“紧凑视图”,“0”表示“默认视图”。
请检查此演示,它使用 XPath 解析文件并读取
MultiWindowMode
的值。Instead of detect if Skype is in “Compact View” or “Default View” using a windows approach try reading the config.xml file which store these kind of settings and is updated in "real-time" by skype. This file is located in
for example in windows 7 this is the location
Inside of this file in the exist a entry called
MultiWindowMode
This is the Xpath location of the
MultiWindowMode
The value of this entry is '1' for “Compact View” and '0' for “Default View”
Check this demo which uses XPath to parse the file and read the value of the
MultiWindowMode
.