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

  1. /*
  2.     GRIDGRAN.C -- Shows the effect of grid granularity on performance
  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 GRIDGRAN (for Borland C++ v3.00)
  8.                  WINIOMS GRIDGRAN (for Microsoft C/SDK)
  9. */
  10.  
  11. #include <windows.h>
  12. #include <stdlib.h>
  13. #include "winio.h" 
  14.  
  15. /* undocumented function */ 
  16. extern void FAR PASCAL SetGridGranularity(int nGran); 
  17.  
  18. #include "checkord.c"
  19.  
  20. int main() 
  21.     {
  22.     char buf[128]; 
  23.  
  24.     // Ord/name check
  25.     if (! CheckOrdName("SetGridGranularity", "USER", 284))
  26.         return 0;
  27.  
  28.     winio_about("GRIDGRAN"
  29.         "\nShows the effect of grid granularity on performance"
  30.         "\n\nFrom Chapter 6 of"
  31.         "\n\"Undocumented Windows\" (Addison-Wesley, 1992)"
  32.         "\nby Andrew Schulman, David Maxey and Matt Pietrek"
  33.         );
  34.  
  35.     puts("Close the window to terminate.");
  36.     for (;;)
  37.         {
  38.         /* prompt for the pattern */
  39.         printf("\nEnter granularity: ");
  40.         gets(buf);
  41.     
  42.         /* ... and call the SetDeskPattern function */
  43.         SetGridGranularity(atoi(buf));
  44.         printf("Grid granularity changed\n");
  45.         
  46.         printf("\nResize or move the window; if you entered\n"
  47.             "a value > 0, the window should 'snap' to grid\n"
  48.             "positions, and window repainting should be faster\n"
  49.             "If you entered 0, the window should move smoothly\n"
  50.             "again but performance will be degraded.\n");
  51.         }
  52.  
  53.     return 0;
  54.     }
  55.