操纵桌面图标的位置 [英] Manipulating the positions of desktop icons
问题描述
我目前正在尝试从桌面上检索图标列表,以更改其位置和/或隐藏它们以及显示其他图标。
I am currently trying to retrieve the list of icons from my desktop to change their locations and / or hide them as well as display others.
我试图获取下面代码中的 FolderView
,但是它甚至不显示我在桌面上的图标数量,因为 count
返回 0 。
I tried to get the FolderView
in the code below but it doesn't even show the number of icons I have on the desktop because count
return 0.
HWND hDesktop = GetDesktopWindow();
HWND hDefView = FindWindowEx(hDesktop, NULL, L"SHELLDLL_DefView", NULL);
HWND folderView = FindWindowEx(hShellWnd, NULL, L"SysListView32", NULL);
int count = (int) SendMessage(folderView, LVM_GETITEMCOUNT, 0, 0);
cout << count << endl;
我对变量进行了测试,并注意到 hDefView
为 NULL
。
可能是 count
返回 0 。
I did tests on the variables and is noticed that hDefView
is NULL
.
Probably the reason why count
return 0.
编辑:将 GetDesktopWindow
替换为 GetShellWindow
结果始终相同, 0
EDIT : After replace GetDesktopWindow
by GetShellWindow
the result is always the same, 0
推荐答案
Shell窗口层次结构没有记录,也不稳定。 ProgMan通常是 SHELLDLL_DefView的父级,但是如果您更改为幻灯片墙纸,也可以是 WorkerW。
The shell window hierarchy is not documented nor stable. "ProgMan" is usually the parent of "SHELLDLL_DefView" but if you change to slideshow wallpaper it can also be "WorkerW".
使用已记录的外壳COM接口检查/操作桌面: IShellWindows
, IShellBrowser
, IFolderView
和 IShellFolder
。
这篇关于操纵桌面图标的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!