home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l430 / 1.ddi / CHAP6.ZIP / SNAPWIND.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  1.4 KB  |  53 lines

  1. /*
  2.     SNAPWIND.C -- Uses SnapWindow put snapshots of windows in the clipboard
  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 SNAPWIND (for Borland C++ v3.00)
  8.                  WINIOMS SNAPWIND (for Microsoft C/SDK)
  9. */
  10.  
  11. #include <windows.h> 
  12. #include "winio.h" 
  13.  
  14. /* undocumented functions */ 
  15. extern BOOL FAR PASCAL SnapWindow(HWND hwnd);
  16.  
  17. #include "checkord.c"
  18.  
  19.  
  20. int main() 
  21.     {
  22.     HWND hwnd;
  23.     char achWindowTitle[128];
  24.  
  25.     // Ord/name check
  26.     if (! CheckOrdName("SnapWindow", "USER", 281))
  27.         return 0;
  28.  
  29.     winio_about("SNAPWIND"
  30.         "\nUses SnapWindow to snap windows into the clipboard"
  31.         "\n\nFrom Chapter 6 of"
  32.         "\n\"Undocumented Windows\" (Addison-Wesley, 1992)"
  33.         "\nby Andrew Schulman, David Maxey and Matt Pietrek"
  34.         );
  35.  
  36.     for (;;)
  37.         {
  38.         puts("Enter the window title of the application window");
  39.         gets(achWindowTitle);
  40.         
  41.         if ((hwnd = FindWindow(NULL, achWindowTitle)) == 0)
  42.             printf("Couldn't locate <%s>....\n", achWindowTitle);
  43.         else
  44.         if (SnapWindow(hwnd))
  45.             printf("Window has been snapped into the clipboard...\n");
  46.         else
  47.             printf("Could not SnapWindow()...!\n");
  48.         }
  49.     
  50.     printf("Program terminated");
  51.     return 0;
  52.     }
  53.