Not quite an answer since I don't know why SHGetSetSettings
does not work. However you can do what the shell does to hide the icons; hide the List-View control.
This is the window hiearchy of the desktop;
'Program Manager' - Progman
'' - SHELLDLL_DefView
'FolderView' - SysListView32
The 'SysListView32' is the one displaying the icons.
You can test and see if the shell is indeed hiding the list-view; hide the icons with the "show desktop icons" item in the view menu, then run the below,
function GetDesktopListView: HWnd;
begin
Result := GetWindow(GetWindow(FindWindow('Progman', nil), GW_CHILD), GW_CHILD);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ShowWindow(GetDesktopListView, SW_SHOW);
end;
and the icons will show again.
Since you're able to check/uncheck the menu item by using 'SHGetSetSettings', the icons' visibility would be -seemingly- in accordance. Also, you don't need to refresh the desktop since the visibility change would take effect immediately.