在 windows7 上将窗口设置为始终保留在桌面上
我正在尝试将我的窗口设置为桌面的子窗口,我这样做是这样的:
HWND ProgmanHwnd =
::FindWindowEx(
::FindWindowEx(
::FindWindow(L"Progman", L"Program Manager"),
NULL,
L"SHELLDLL_DefView",
L""),
NULL,
L"SysListView32",
L"FolderView");
SetParent(m_hWnd, ProgmanHwnd);
这在 windowsXP 中工作正常,我的窗口位于所有窗口下方,当我按“显示桌面”选项时,窗口将显示所有内容其他“正常”窗口被隐藏。
但是在Win7中,当我执行上述代码时,不会显示相同的窗口,在spy++中,我可以看到我的窗口是SysListView32的子窗口,但它不显示(并且它具有WM_VISIBLE样式)?
我缺少什么?或者从winXP到win7发生了什么变化?我怎样才能做到这一点才能在win7上工作?
更新: 这与航空主题有关,因为如果我将桌面主题更改为基本主题,则会显示窗口,但如果我切换回航空主题之一,则会再次隐藏。
谢谢
I'm trying to set my window a child of the desktop, and i'm doing this like this:
HWND ProgmanHwnd =
::FindWindowEx(
::FindWindowEx(
::FindWindow(L"Progman", L"Program Manager"),
NULL,
L"SHELLDLL_DefView",
L""),
NULL,
L"SysListView32",
L"FolderView");
SetParent(m_hWnd, ProgmanHwnd);
This works fine in windowsXP, my window is underneath all windows and when i press the "show desktop" option the window shows and all other "normal" windows are hide.
But in Win7 when i do the above code the same window is not displayed, in spy++ i can see that my window is a child window of the SysListView32 but it not display (and it has the WM_VISIBLE style)?
What i'm missing? or what changed from winXP to win7? how can i do this to work on win7?
Update:
It's got something to do with aero theme, because if i change the desktop theme to the basic then the window is displayed, but if i switch back to one of the aero theme then is hided again.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我尝试了你的代码,它与我的测试 MFC 应用程序配合得很好。除非您在 SetParent 之前需要双冒号。你引用的代码放在哪里了?我已将其放入 OnCreate 函数中。工作没有问题。
I tried your code and it works fine with my test MFC app. Except you need double colon before SetParent. Where did you put the code that you quote? I've put mine in OnCreate function. Works without problems.
桌面窗口是 ProgMan->SHELLDLL_DefView->SysListView32 的一部分
而不是winxp中直接在程序下。
让下面用java编写的代码片段
尝试{
NativeCall.init();
IntCall ic = new IntCall("user32.dll", "FindWindowA");
父= ic.executeCall(新对象[] {
“ProgMan”、“程序经理”});
ic.destroy();
System.out.println("父级:"+parent);
}
the desktop windows is part of ProgMan->SHELLDLL_DefView->SysListView32
instead of directly under program in winxp.
let the following code snippet written in java
try {
NativeCall.init();
IntCall ic = new IntCall("user32.dll", "FindWindowA");
parent = ic.executeCall(new Object[]{
"ProgMan", "Program Manager"});
ic.destroy();
System.out.println(" parent :"+parent);
}