home *** CD-ROM | disk | FTP | other *** search
- /*
- GRIDGRAN.C -- Shows the effect of grid granularity on performance
-
- From Chapter 6 of "Undocumented Windows" (Addison-Wesley 1992)
- by Andrew Schulman, Dave Maxey and Matt Pietrek
-
- Build using: WINIOBC GRIDGRAN (for Borland C++ v3.00)
- WINIOMS GRIDGRAN (for Microsoft C/SDK)
- */
-
- #include <windows.h>
- #include <stdlib.h>
- #include "winio.h"
-
- /* undocumented function */
- extern void FAR PASCAL SetGridGranularity(int nGran);
-
- #include "checkord.c"
-
- int main()
- {
- char buf[128];
-
- // Ord/name check
- if (! CheckOrdName("SetGridGranularity", "USER", 284))
- return 0;
-
- winio_about("GRIDGRAN"
- "\nShows the effect of grid granularity on performance"
- "\n\nFrom Chapter 6 of"
- "\n\"Undocumented Windows\" (Addison-Wesley, 1992)"
- "\nby Andrew Schulman, David Maxey and Matt Pietrek"
- );
-
- puts("Close the window to terminate.");
- for (;;)
- {
- /* prompt for the pattern */
- printf("\nEnter granularity: ");
- gets(buf);
-
- /* ... and call the SetDeskPattern function */
- SetGridGranularity(atoi(buf));
- printf("Grid granularity changed\n");
-
- printf("\nResize or move the window; if you entered\n"
- "a value > 0, the window should 'snap' to grid\n"
- "positions, and window repainting should be faster\n"
- "If you entered 0, the window should move smoothly\n"
- "again but performance will be degraded.\n");
- }
-
- return 0;
- }
-