home *** CD-ROM | disk | FTP | other *** search
/ Software Collection (I) / TOOLS.iso / b11 / 1.img / CHAP6.ZIP / TILECHLD.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  1.8 KB  |  68 lines

  1. /*
  2.     TILECHLD.C -- Uses TileChildWindows to tile desktop
  3.  
  4.     From Chapter 6 of "Undocumented Windows" (Addison-Wesley 1992)
  5.     by Andrew Schulman, Dave Maxey and Matt Pietrek
  6.  
  7.     Build using: WINIOBC TILECHLD (for Borland C++ v3.00)
  8.                  WINIOMS TILECHLD (for Microsoft C/SDK)
  9. */
  10.  
  11. #include <windows.h> 
  12. #include "winio.h" 
  13.  
  14. #ifndef MDITILE_VERTICAL
  15. #define MDITILE_VERTICAL    0x0000
  16. #define MDITILE_HORIZONTAL    0x0001
  17. #endif
  18.  
  19. /* undocumented function - no function prototype
  20.    because it differs between 3.0 and 3.1 */ 
  21. extern void FAR PASCAL TileChildWindows();
  22.  
  23. #include "checkord.c"
  24.  
  25. int main() 
  26.     {
  27.     WORD wVer = (WORD) GetVersion();
  28.     
  29.     // Ord/name check
  30.     if (! CheckOrdName("TileChildWindows", "USER", 199))
  31.         return 0;
  32.  
  33.     winio_about("TILECHLD"
  34.         "\nUses TileChildWindows to tile the desktop"
  35.         "\n\nFrom Chapter 6 of"
  36.         "\n\"Undocumented Windows\" (Addison-Wesley, 1992)"
  37.         "\nby Andrew Schulman, David Maxey and Matt Pietrek"
  38.         );
  39.  
  40.     winio_setecho(winio_current(), FALSE);
  41.     
  42.     for (;;)
  43.         if (wVer == 0x0003)
  44.             {
  45.             puts("Press a key to tile the desktop.");
  46.             getchar();
  47.     
  48.             TileChildWindows(GetDesktopWindow());
  49.             }
  50.         else
  51.             {
  52.             puts("Press a key to tile the desktop horizontally.");
  53.             getchar();
  54.     
  55.             TileChildWindows(GetDesktopWindow(), MDITILE_HORIZONTAL);
  56.     
  57.             puts("Press a key to tile the desktop vertically.");
  58.             getchar();
  59.     
  60.             TileChildWindows(GetDesktopWindow(), MDITILE_VERTICAL);
  61.             }
  62.     
  63.     // BCC spots the fact that logically we can't reach here -
  64.     // Ignore the warning.
  65.     printf("Program terminated");
  66.     return 0;
  67.     }
  68.