473,320 Members | 1,831 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

[C#] Hide desktop icons?

How can I hide the icons on my desktop? I've used the code below, but the problem is that it totally disables the desktop (no rightclick-menu, etc).
Expand|Select|Wrap|Line Numbers
  1. [DllImport("user32.dll")]
  2. static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
  3. [DllImport("user32.dll", SetLastError = true)]
  4. static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);
  5. void ShowDesktopIcons(bool show)
  6. {
  7.     IntPtr hWnd = FindWindowEx(IntPtr.Zero, IntPtr.Zero, "Progman", null);
  8.     if (show)
  9.        ShowWindow(hWnd, 5);
  10.     else
  11.        ShowWindow(hWnd, 0);
  12. }
  13.  
Thanks in advance :)
Aug 8 '08 #1
1 7526
joedeene
583 512MB
how about taking a look at this tutorial

http://www.devx.com/vb2themax/Tip/18313
Aug 8 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Tinus | last post by:
Hello all, I was wondering.... Is there a way to hide/unhide the Desktop Icons in C#? I've googled the net for it but couldn't find anything usefull :-( ANd if it is possiple, could someone...
4
by: Blaine | last post by:
Does anyone know how I can hide a form from the TaskManager? I've set the ShowInTaskbar to False, but when using Alt-TAB to switch between applications, it appears as a blank icon. I can set it...
1
by: Henrik | last post by:
I'm sorry to trouble you once again but somebody must know how to get a list of the desktop icons and their respective positions. I know that I have to look into shell but I have no idea how to...
0
by: AvecFromage | last post by:
Hi, I'd like to be able to read the positions of all the Icons on my WinXP desktop. I've had a look around to see how to do it and I've come up with the code below...but it doesn't work. :o( ...
1
by: mimenko | last post by:
Hello, I'd want to show and hide the same icons (pictures) on a web page that contains several icons. Some are identical, some are different (for ex : 3 items "A", 4 items "B", 2 items "C"). Is...
5
by: GH | last post by:
Is it possible to display images on the desktop itself, like the bacground but not as a background? And not as icons either. Anything you put in the \Desktop folder shows up as an icon on the...
4
by: O | last post by:
My files I have on my desktop have disappeared from the desktop. The strange thing is that when I go on my computer they appear to be under desktop, and i Can access from there. but there not in...
0
by: suvarnask1 | last post by:
WIndows 2000-Desktop icons not Displaying After Booting process One msg "Userenv.dll is missing" after click on that not display the desktop icons and cant do anything on the system.
0
by: =?Utf-8?B?QW5kcmV3?= | last post by:
I have a form in vs 2005 that does not move. Is there a way to have the form under the icons above the desktop? If so would it be possible to have that form at time that I want to move it, pop...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.