/*****************************************************************/
/*    Last revision: 21 August 1998                              */
/*    OS: Win95/98/NT                                            */
/*    Source has been tested on Borland C++Builder               */
/*    Author: Alexey Vasilyev                                    */
/*    Email: servent@apollo.lv                                   */
/*    Home page: http://www.halyava.ru/aaalexey                  */
/*****************************************************************/

Content:
~~~~~~~~
1. How to reload Explorer?
2. How to emulate CTRL+ESC key press (to show start menu)?
3. How to unload the Start Button from the taskbar?
4. How to hide the Windows taskbar?
5. How to clear all files from recent documents menu?
6. How to create an app which will be not displayed in tasklist the
   by pressing CTRL+ALT+DEL?
7. How to check if an app is already running?
8. How to create non-rectangular windows?
9. How to hide an app from taskbar?

/*****************************************************************/

///////////////////////////////////////////////////////////////////
1. How to reload Explorer?
///////////////////////////////////////////////////////////////////

 HWND hwndShell;
 hwndShell = FindWindow ("Progman", NULL);
 PostMessage (hwndShell, WM_QUIT, 0, 0L);
 ShellExecute (0, "open", "Explorer", NULL, NULL, SW_SHOWNORMAL);

ps: See MS Knowledge Base Q137572

///////////////////////////////////////////////////////////////////
2. How to emulate CTRL+ESC key press (to show start menu)?
///////////////////////////////////////////////////////////////////

 HWND hwndShell;
 hwndShell = FindWindow ("Progman", NULL);
 //hwndShell = FindWindow ("Shell_TrayWnd", NULL);     // The same
 SendMessage (hwndShell, WM_SYSCOMMAND, SC_TASKLIST, 0);

///////////////////////////////////////////////////////////////////
3. How to unload the Start Button from the taskbar?
///////////////////////////////////////////////////////////////////

 HWND hwndTaskbar, hwndButton;
 hwndTaskbar= FindWindow   ("Shell_TrayWnd", NULL);          // Taskbar
 hwndButton = FindWindowEx (hwndTaskbar, 0, "Button", NULL); // Button
 SendMessage (hwndButton, WM_CLOSE, 0, 0);

///////////////////////////////////////////////////////////////////
4. How to hide the Windows taskbar?
///////////////////////////////////////////////////////////////////

 HWND hwndTaskbar;
 hwndTaskbar = FindWindow ("Shell_TrayWnd", NULL);
 SetWindowPos (hwndTaskbar, 0, 0, 0, 0, 0, SWP_HIDEWINDOW);  // Hide taskbar
 //SetWindowPos (hwndTaskbar, 0, 0, 0, 0, 0, SWP_SHOWWINDOW);// Show it again

///////////////////////////////////////////////////////////////////
5. How to clear all files from recent documents menu?
///////////////////////////////////////////////////////////////////
 
#include <shlobj.h>

 SHAddToRecentDocs (0, 0);

ps: To add files to recent document menu read WinAPI help of
    the function SHAddToRecentDocs ().

///////////////////////////////////////////////////////////////////
6. How to create an app which will be not displayed in the tasklist 
   by pressing CTRL+ALT+DEL?
///////////////////////////////////////////////////////////////////

#include "process.h"

 RegisterServiceProcess (NULL, RSP_SIMPLE_SERVICE);

ps: RegisterServiceProcess isn't defined in WinAPI. See process.h.

///////////////////////////////////////////////////////////////////
7. How to check if an app is already running?
///////////////////////////////////////////////////////////////////

//place this code in the beginning of the WinMain function
 if (FindWindow ("TForm1", "Form1")!= NULL)
    { 
     MessageBox (0, "Application is already running", "Error", MB_OK);
     PostQuitMessage (0);                      // Exiting from the app
    }

ps: If you are using Borland C++Builder or Borland Delphi to try to test
    this code you need to close the project and run the application
    separetly. If you'll run the app from the project this message always 
    occurs, because the instance of the app has been already created in 
    design time.

///////////////////////////////////////////////////////////////////
8. How to create non-rectangular windows?
///////////////////////////////////////////////////////////////////

#include <winuser.h>
#include <wingdi.h>

 // This variable has to be global
 HRGN FormRgn;
   ...

 // Place this code in the form create handle
 RECT WinRect;
 // In C++Builder use _WINUSER_::GetClientRect (...)
 GetClientRect (hwnd, &WinRect);                 // Get Rect of the window
 FormRgn = CreateEllipticRgnIndirect (&WinRect); // Create region
 SetWindowRgn (hwnd, FormRgn, true);             // Set region as current

   ...
 // Place this code in the form destroy handle
 DeleteObject (FormRgn);

ps: See MS Knowledge Base Q125669

///////////////////////////////////////////////////////////////////
9. How to hide an app from taskbar?
///////////////////////////////////////////////////////////////////

 HWND hWnd = FindWindow (NULL, "window name");
 ShowWindow (hWnd, SW_HIDE);

by Liz Marks <lizard@lizardworks.com>

///////////////////////////////////////////////////////////////////
X. This could be an your tip. Email me if you have one with source
   in any programming laguage.
///////////////////////////////////////////////////////////////////
