I like to use large icons on my desktop, but very often they back to normal size, still can't trace why :). As a programmer I decide to write my own utility for saving and restoring icons positions. Googling around doesn't give much info. Can anyone give me a hint or point to link where I could start?
read this post, maybe it helps :) save-and-restore-desktop-icon-positions
At one point in time, ie Win2k/WinXP for sure, the desktop was actually a type of ListView. I'm not sure it's still that in the new OS's. Knowing that it was easy to get the desktop handle and using the LV api functions manipulate it into doing things like displaying with the Report style.
Here are two functions that show you how to start manipulating the desktop.
Note: I know this works upto WinXP, and I assume that it will work for Vista and Win7 but I haven't tested it. Using these examples it shouldn't take you long to write a set of functions to get/set the icon positions of everything on the desktop.
procedure ReportStyleDesktop;
var
wHandle : THandle;
wStyle : Longint;
begin
wHandle := GetDesktopWindow;
if wHandle <> 0 then
wHandle := FindWindowEx(wHandle, 0, 'Progman', 'Program Manager');
if wHandle <> 0 then
wHandle := FindWindowEx(wHandle, 0, 'SHELLDLL_DefView', 0);
if wHandle <> 0 then
wHandle := FindWindowEx(wHandle, 0, 'SysListView32', 0);
if wHandle <> 0 then
begin
wStyle := GetWindowLong(wHandle, GWL_STYLE);
wStyle := wStyle and (not LVS_TYPEMASK);
wStyle := wStyle or LVS_REPORT or LVS_ICON;
SetWindowLong(wHandle, GWL_STYLE, wStyle);
end;
end;
procedure NormalStyleDesktop;
var
wHandle : THandle;
wStyle : Longint;
begin
wHandle := GetDesktopWindow;
if wHandle <> 0 then
wHandle := FindWindowEx(wHandle, 0, 'Progman', 'Program Manager');
if wHandle <> 0 then
wHandle := FindWindowEx(wHandle, 0, 'SHELLDLL_DefView', 0);
if wHandle <> 0 then
wHandle := FindWindowEx(wHandle, 0, 'SysListView32', 0);
if wHandle <> 0 then
begin
wStyle := GetWindowLong(wHandle, GWL_STYLE);
wStyle := wStyle and (not LVS_TYPEMASK);
wStyle := wStyle or LVS_ICON;
SetWindowLong(wHandle, GWL_STYLE, wStyle);
end;
end;
You can't reliably. Raymond Chen explains why in this post.
Basically, it's because there's no way to force an icon to be in a specific location on the desktop, meaning there's no way to specify where an individual icon will be positioned.