home *** CD-ROM | disk | FTP | other *** search
- /*
- SNAPWIND.C -- Uses SnapWindow put snapshots of windows in the clipboard
-
- From Chapter 6 of "Undocumented Windows" (Addison-Wesley 1992)
- by Andrew Schulman, Dave Maxey and Matt Pietrek
-
- Build using: WINIOBC SNAPWIND (for Borland C++ v3.00)
- WINIOMS SNAPWIND (for Microsoft C/SDK)
- */
-
- #include <windows.h>
- #include "winio.h"
-
- /* undocumented functions */
- extern BOOL FAR PASCAL SnapWindow(HWND hwnd);
-
- #include "checkord.c"
-
-
- int main()
- {
- HWND hwnd;
- char achWindowTitle[128];
-
- // Ord/name check
- if (! CheckOrdName("SnapWindow", "USER", 281))
- return 0;
-
- winio_about("SNAPWIND"
- "\nUses SnapWindow to snap windows into the clipboard"
- "\n\nFrom Chapter 6 of"
- "\n\"Undocumented Windows\" (Addison-Wesley, 1992)"
- "\nby Andrew Schulman, David Maxey and Matt Pietrek"
- );
-
- for (;;)
- {
- puts("Enter the window title of the application window");
- gets(achWindowTitle);
-
- if ((hwnd = FindWindow(NULL, achWindowTitle)) == 0)
- printf("Couldn't locate <%s>....\n", achWindowTitle);
- else
- if (SnapWindow(hwnd))
- printf("Window has been snapped into the clipboard...\n");
- else
- printf("Could not SnapWindow()...!\n");
- }
-
- printf("Program terminated");
- return 0;
- }
-