-
December 16th, 2006, 08:47 PM
#1
Hiding desktop icons
I am trying to write a small program that will hide the desktop icons. I tried the reg edit thing but you have to restart explorer when you hide/show them. I also tried this. x=0 will show the desktop x!=0 will hide it.
HWND hw;
hw = FindWindowEx(0,0,"Progman", NULL);
ShowWindow(hw, x);
However this completely disables the desktop (no right click) and i have some trouble with explorer crashing every now and then when i use it. Does anyone know what command is called when you right click on the desktop "Arrange Icons by" --> "Show Desktop Icons"
Ideally this is the command that i would like to use if it is accessible
-
December 17th, 2006, 05:51 PM
#2
Re: Hiding desktop icons
Are you attemping to do this in Visual Basic? It looks that way. If so, is it 6 or .Net?
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
December 23rd, 2006, 04:15 AM
#3
Re: Hiding desktop icons
It might be best if you use Group Policies to hide desktop icons, drives, or control panel appletts.
-
December 23rd, 2006, 04:51 AM
#4
Re: Hiding desktop icons
Originally Posted by PeejAvery
Are you attemping to do this in Visual Basic? It looks that way. If so, is it 6 or .Net?
I'd say it's more Visual C++, because of the ; behind the statements
All may be well when you eventually hide and show the icons, but isn't it better to allow the user to be able to do this. All system settings IMHO, must be up to the user to decide whether he / she wants to change it.
Why do you need such a program that does this ¿
I never could understand why programmers must do this.
I'm not being funny or anything, but, it's just my opinion.
Remember also that not every use is an advanced user. Some beginner users might not have a clue of what's going on and why, and of course how to fix it!
Some users may want their icons to be always displayed, some may not, but it should ultimately be up to the user to decide.
Just my 2 cents, don't shoot me it's Christmas!
Last edited by HanneSThEGreaT; December 28th, 2006 at 02:04 AM.
Reason: Wrong Code
-
December 23rd, 2006, 01:27 PM
#5
Re: Hiding desktop icons
Could be like I have seen, the client desires a controlled environment (desktop) in a business network. This is where using GPOs is more beneficial then writting any code.
Ps, looks like C# possibly.
-
December 27th, 2006, 03:57 PM
#6
Re: Hiding desktop icons
You have to find Progman, then the desktop window and then the listview containing the actual icons. Something like the following in C++:
Code:
HWND GetDesktopListViewHWND()
{
HWND hDesktopListView = NULL;
HWND hProgman = FindWindow(_T("Progman"), 0);
if (hProgman)
{
HWND hDesktop = FindWindowEx(hProgman, 0, _T("SHELLDLL_DefView"), 0);
if (hDesktop)
{
hDesktopListView = FindWindowEx(hDesktop, 0, _T("SysListView32"), 0);
}
}
return hDesktopListView;
}
void ShowDesktopIcons(BOOL bShow)
{
HWND hWndDesktopListView = GetDesktopListViewHWND();
ShowWindow(hWndDesktopListView, (bShow?SW_SHOW:SW_HIDE));
}
Last edited by Marc G; January 5th, 2012 at 12:19 PM.
Reason: Corrected my old code
-
December 28th, 2006, 01:45 AM
#7
Re: Hiding desktop icons
Originally Posted by Marc G
You have to find Progman, then the desktop window and then the listview containing the actual icons. Something like the following in C++:
Code:
HWND GetDesktopListViewHWND()
{
HWND hDesktopListView = NULL;
HWND hProgman = FindWindow(_T("Progman"), 0);
if (hProgman)
{
HWND hDesktop = FindWindowEx(hProgman, 0, _T("SHELLDLL_DefView"), 0);
if (hDesktop)
{
hDesktopListView = FindWindowEx(hDesktop, 0, _T("SysListView32"), 0);
}
}
return hDesktopListView;
}
void ShowDesktopIcons(BOOL bShow)
{
HWND hWndDesktopListView = GetDesktopListViewHWND(&hWndDesktopListView, NULL, NULL);
ShowWindow(hWndDesktopListView, (bShow?SW_SHOW:SW_HIDE));
}
Oh Yes, now I remember....
The other day, I answered this thread, and when I saw SHELLDLL_DefView and SysListView32 in your post, I remembered it. You are right you have to get the Program, then SHELLDLL_DefView, and then you have access to the icons.
I also found this on CodeProject :
http://www.codeproject.com/tips/Tran...35&exp=0&fr=26
Why am I so forgetful!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|