WinApi - How to obtain SHELLDLL_DefView

ぃ、小莉子 提交于 2019-12-02 21:15:51

问题


I am trying to obtain handle to SHELLDLL_DefView.

So, I have this code.

HWND hProgman = FindWindow(L"Progman", NULL);
HWND hWnd = FindWindowEx(hProgman, 0, L"SHELLDLL_DefView", NULL);

Eveyrtihing works OK, until I change in Windows desktop brackground to slideshow. Then when I search with spy++ hierarchy of the windows, than SHELLDLL_DefView has another parent. Now it is #32769 (Desktop) -> WorkerW -> SHELLDLL_DefView. So I can't find it. Problem is that when I try

HWND desktop = GetDesktopWindow();
HWND hWnd = FindWindowEx(desktop , 0, L"WorkerW", NULL);
HWND hWnd = FindWindowEx(hWnd, 0, L"SHELLDLL_DefView", NULL);

Than SHELLDLL_DefView is not found. WorkerW yes.

Can anybody help?


回答1:


I found the answer. Need to iterate through all WorkerW.

HWND destop = GetDesktopWindow();
HWND hWorkerW = NULL;
HWND hShellViewWin = NULL;
do
{
    hWorkerW = FindWindowEx(destop, hWorkerW, L"WorkerW", NULL);
    hShellViewWin = FindWindowEx(hWorkerW, 0, L"SHELLDLL_DefView", 0);
} while (hShellViewWin == NULL && hWorkerW != NULL);


来源:https://stackoverflow.com/questions/36566675/winapi-how-to-obtain-shelldll-defview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!