Can't use Win32 SHELLSTATE structure!

Windows specific forum
User avatar
Thunder93
Addict
Addict
Posts: 1788
Joined: Tue Mar 21, 2006 12:31 am
Location: Canada

Re: Can't use Win32 SHELLSTATE structure!

Post by Thunder93 »

SHGetSetSettings is like you said, its deprecated. However, it still exists and working under Windows 7 x64. However at any time SHGetSetSettings can be removed, like they enjoy pointing out. Who knows though.. maybe they finally removed this function from Windows 8?

You was actually onto something. The problem was you were expecting that final step to actually hide desktop icons on the spot. It would toggle the "Show Desktop Icons" menu item state. This also uses registry item ' HideIcons ' which it toggled with. If you would have re-booted the computer, it would have been obvious it worked the way it was intended to.

I originally thought SHChangeNotify could bring us with that final step. While it refreshed the desktop, it would not consider the Show or Hidden states.

Therefore adding the following, would suffice.

Code: Select all

ShowWindow_(FindWindow_(0, "Program Manager"), #SW_HIDE)
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
Hi-Toro
Enthusiast
Enthusiast
Posts: 269
Joined: Sat Apr 26, 2003 3:23 pm

Re: Can't use Win32 SHELLSTATE structure!

Post by Hi-Toro »

Yeah, apparently it does hide the icons on Windows XP, but I'm on 7 (64-bit) and it doesn't. I did actually try SHChangeNotify but obviously to no avail.

It looks like the window-based methods (yours and RASHAD's) actually disable the desktop, rather than just hide the icons -- you can't click-drag the selection rectangle or use the right mouse button. Not sure if that was ever possible, though...

No idea what the 'correct' method for doing this is now -- they probably don't want us to be doing it, even if it's for our own use!

I really appreciate the help on this topic though. Couldn't believe how quickly you guys replied with answers to a pretty obscure problem!
James Boyd
http://www.hi-toro.com/
Death to the Pixies!
User avatar
Thunder93
Addict
Addict
Posts: 1788
Joined: Tue Mar 21, 2006 12:31 am
Location: Canada

Re: Can't use Win32 SHELLSTATE structure!

Post by Thunder93 »

Yes.. I see what you mean, regarding the way it hides. :shock:
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
User avatar
Thunder93
Addict
Addict
Posts: 1788
Joined: Tue Mar 21, 2006 12:31 am
Location: Canada

Re: Can't use Win32 SHELLSTATE structure!

Post by Thunder93 »

Execute the following code, once to hide, again to show. :)

Code: Select all

#toggleDesktopCommand = $7402
hWnd = GetWindow_(FindWindow_("Progman", "Program Manager"), #GW_CHILD)
SendMessage_(hWnd, #WM_COMMAND, #toggleDesktopCommand, 0)
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
Hi-Toro
Enthusiast
Enthusiast
Posts: 269
Joined: Sat Apr 26, 2003 3:23 pm

Re: Can't use Win32 SHELLSTATE structure!

Post by Hi-Toro »

Ohhh, nice one, thanks... works fine here on 64-bit Windows 7!
James Boyd
http://www.hi-toro.com/
Death to the Pixies!
User avatar
Thunder93
Addict
Addict
Posts: 1788
Joined: Tue Mar 21, 2006 12:31 am
Location: Canada

Re: Can't use Win32 SHELLSTATE structure!

Post by Thunder93 »

I thought that you might like that one. :mrgreen:
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
Post Reply