我可以以某种方式设置“SHELLDLL_DefView”的父级。处理“WorkerW” [英] Can I somehow set the Parent of "SHELLDLL_DefView" handle to a "WorkerW"
本文介绍了我可以以某种方式设置“SHELLDLL_DefView”的父级。处理“WorkerW”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,
在Windows启动时(使用Windows 10),窗口顺序(通过Spy ++)如下所示:
< pre lang =text> WorkerW
Progman
* SHELLDLL_DefView
按下WIN + TAB后,它看起来像这样:
Progman
WorkerW
* SHELLDLL_DefView
因为我的程序是SHELLDLL_DefView的子项,所以它得到了半按WIN + TAB后透明我希望每个代码完成此更改,而不是用户突然完成。
我试过这个,但没有任何反应:
IntPtr progmanHandle = FindWindowEx( IntPtr .Zero,< span class =code-sdkkeyword> IntPtr .Zero, Progman,< span class =code-keyword> null );
IntPtr shell = FindWindowEx(progmanHandle, IntPtr .Zero, SHELLDLL_DefView, null );
IntPtr workerWHandle = FindWindowEx( IntPtr .Zero, IntPtr .Zero, WorkerW,空跨度>);
SetParent(shell,workerWHandle);
请帮助!
Julian
解决方案
private static IntPtr GetDesktopListView(){
var hDesktop = IntPtr的跨度> .Zero;
var hProgman = W32Api.FindWindow( Progman, );
if (hProgman!= IntPtr .Zero){
// hProgman可用!
hDesktop = W32Api.FindWindowEx(hProgman, IntPtr .Zero, SHELLDLL_DefView,
IntPtr .Zero);
}
如果(hDesktop!= IntPtr .Zero){
// hDesktop可用!
返回 W32Api.FindWindowEx(hDesktop, IntPtr .Zero, SysListView32,
IntPtr .Zero);
}
// 如果我们达到这一点,那意味着SHELLDLL_DefView 不是兄弟姐妹
// Progman!现在我们要从Progman(Windows 7及更高版本)中生成WorkerW
// (shhhh ...此Windows消息未记录!)
const int WmSpawnWorker = 0x052C;
W32Api.SendMessage(hProgman,WmSpawnWorker, 0 , 0 );
hDesktop = W32Api.GetDesktopWindow();
IntPtr hShellViewWin;
var hWorkerW = IntPtr .Zero;
执行 {
hWorkerW = W32Api.FindWindowEx(hDesktop,hWorkerW, < span class =code-string> WorkerW, IntPtr .Zero);
hShellViewWin = W32Api.FindWindowEx(hWorkerW, IntPtr .Zero, SHELLDLL_DefView,
IntPtr .Zero);
} while (hShellViewWin == IntPtr .Zero&& hWorkerW!= IntPtr的跨度> .Zero);
return W32Api.FindWindowEx(hShellViewWin, IntPtr .Zero, SysListView32,
IntPtr .Zero);
}
Hi there,
On Windows startup (using Windows 10) the window order (by Spy++) looks like this:
WorkerW
Progman
* SHELLDLL_DefView
After pressing WIN+TAB it looks like this:
Progman
WorkerW
* SHELLDLL_DefView
Since my program is a child of SHELLDLL_DefView and it gets semi-transparent after pressing WIN+TAB i want to get this change done per code and not suddenly by a user.
I tried this, but nothing happens:
IntPtr progmanHandle = FindWindowEx(IntPtr.Zero, IntPtr.Zero, "Progman", null);
IntPtr shell = FindWindowEx(progmanHandle, IntPtr.Zero, "SHELLDLL_DefView", null);
IntPtr workerWHandle = FindWindowEx(IntPtr.Zero, IntPtr.Zero, "WorkerW", null);
SetParent(shell, workerWHandle);
Please help!
Julian
解决方案
private static IntPtr GetDesktopListView(){ var hDesktop = IntPtr.Zero; var hProgman = W32Api.FindWindow("Progman", ""); if (hProgman != IntPtr.Zero){ // hProgman is usable! hDesktop = W32Api.FindWindowEx(hProgman, IntPtr.Zero, "SHELLDLL_DefView", IntPtr.Zero); } if (hDesktop != IntPtr.Zero){ // hDesktop is usable! return W32Api.FindWindowEx(hDesktop, IntPtr.Zero, "SysListView32", IntPtr.Zero); } // If we reach this point, that means that "SHELLDLL_DefView" is NOT a sibling // of "Progman"! Now we gotta spawn "WorkerW" from "Progman" (Windows 7 and beyond) // (shhhh... this windows message is NOT DOCUMENTED!) const int WmSpawnWorker = 0x052C; W32Api.SendMessage(hProgman, WmSpawnWorker, 0, 0); hDesktop = W32Api.GetDesktopWindow(); IntPtr hShellViewWin; var hWorkerW = IntPtr.Zero; do { hWorkerW = W32Api.FindWindowEx(hDesktop, hWorkerW, "WorkerW", IntPtr.Zero); hShellViewWin = W32Api.FindWindowEx(hWorkerW, IntPtr.Zero, "SHELLDLL_DefView", IntPtr.Zero); } while (hShellViewWin == IntPtr.Zero && hWorkerW != IntPtr.Zero); return W32Api.FindWindowEx(hShellViewWin, IntPtr.Zero, "SysListView32", IntPtr.Zero); }
这篇关于我可以以某种方式设置“SHELLDLL_DefView”的父级。处理“WorkerW”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文