[Home] You are not logged in. You can create an account here or login here

Just my stuff

Destroy/remove/hide/kill the show desktop button in Windows 7

I actually hate that button. I am used to go to the lower-right corner with my mouse when I want to see the calendar, not when I want to see my desktop. That’s why I wanted to get rid of it, but there is no option anywhere to do so.
Long story short, I wrote a very small C++ program to kill it. Here it is:
  
// DestroyShowDesktop.cpp : Kill the show desktop button, by S2
//

#include "stdafx.h" 
#include "windows.h" 

int _tmain(int argc, _TCHAR* argv[])
{

    HWND hTrayWnd, hTrayNotifyWnd, hButton;

    hTrayWnd = FindWindow(_T("Shell_TrayWnd"), _T(""));
    if (!hTrayWnd) return 0;
    hTrayNotifyWnd = FindWindowEx(hTrayWnd, 0, _T("TrayNotifyWnd"), _T(""));
    if (!hTrayNotifyWnd) return 0;

    //Get the Show Desktop Button which is a child of TrayNotifyWnd.
    hButton = FindWindowEx(hTrayNotifyWnd, 0, _T("TrayShowDesktopButtonWClass"), _T(""));
    if (!hButton) return 0;

    //KILL IT!
    SendMessage(hButton, WM_DESTROY, NULL, NULL);

    //repaint the systray
    SendMessage(hTrayNotifyWnd, WM_PAINT, NULL, NULL);

    return 0;
}


And if you don’t want to compile it yourself, here is the compiled exe.
Just move a link to it in your Startup Start menu, set it to run with Admin rights and you are all set.
Anonymous Ramana said...

Not sure why it did not work for me. I ran your exe, it did not help. So I made subtle changes to make use of
SendMessage(hButton,WM_SYSCOMMAND, SC_CLOSE, NULL); instead of your last two sendmessages. It worked then. Thanks.

Sat Aug 27 16:32:31 +0200 2011
Anonymous SmartCrab said...

Ei Ramana, can u upload the .exe of your code version?.

Sun Sep 11 03:54:57 +0200 2011
 
Comments for this post have been disabled