home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Interactive Guide / c-cplusplus-interactive-guide.iso / c_ref / csource1 / cenvew / pmcorner.cmm < prev    next >
Encoding:
Text File  |  1993-10-21  |  1.0 KB  |  30 lines

  1. // PMCorner.cmm - Minimize the Program Manager and put its
  2. //                icon into the lower right-hand corner of
  3. //                the screen.  If Program Manager is not
  4. //                running then just exit.
  5.  
  6. #include <WinUtil.lib>  // Lots of useful routines
  7. #include <Message.lib>  // Send messages to windows
  8.  
  9. // Get the Window handle based on the "Program Manager" text
  10. handle = GetWindowHandle("Program Manager");
  11. if ( handle != NULL ) {
  12.  
  13.    // Minimize this window
  14.    SendMessage(handle,WM_SYSCOMMAND,SC_MINIMIZE,0);
  15.  
  16.    // Find out the size of this window and the size of the screen
  17.    IconBox = GetWindowRect(handle);
  18.    IconWidth = IconBox.right - IconBox.left + 1;
  19.    IconHeight = IconBox.bottom - IconBox.top + 1;
  20.    ScreenWidth = GetSystemMetrics(SM_CXSCREEN);
  21.    ScreenHeight = GetSystemMetrics(SM_CYSCREEN);
  22.  
  23.    // Move this icon to lower-right corner of screen
  24.    MoveWindow(handle,
  25.               ScreenWidth-IconWidth,ScreenHeight-IconHeight,
  26.               IconWidth,IconHeight,TRUE);
  27.  
  28. }
  29.  
  30.