[C#] Hide desktop icons?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Kartoffelen
    New Member
    • Feb 2008
    • 5

    [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).
    Code:
    [DllImport("user32.dll")]
    static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
    [DllImport("user32.dll", SetLastError = true)]
    static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);
    void ShowDesktopIcons(bool show)
    {
        IntPtr hWnd = FindWindowEx(IntPtr.Zero, IntPtr.Zero, "Progman", null);
        if (show)
           ShowWindow(hWnd, 5);
        else
           ShowWindow(hWnd, 0);
    }
    Thanks in advance :)
  • joedeene
    Contributor
    • Jul 2008
    • 579

    #2
    how about taking a look at this tutorial

    For those who may not know this, you can have an optional Parameter in SQL. It took me forever to figure it out.

    Comment

    Working...