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

  1. /*
  2.     GETNEXTQ.C -- Uses GetNextQueueWindow to walk the window Z order
  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 GETNEXTQ (for Borland C++ v3.00)
  8.                  WINIOMS GETNEXTQ (for Microsoft C/SDK)
  9. */
  10.  
  11. #include <windows.h>
  12. #include <ctype.h>
  13. #include "winio.h"
  14.  
  15. /* undocumented functions */ 
  16. extern HANDLE FAR PASCAL GetNextQueueWindow(HWND hwnd, int nWhichWay);
  17. extern void FAR PASCAL SwitchToThisWindow(HWND hwnd, BOOL tRestore);
  18.  
  19. #define GNQW_PREVIOUS   1
  20. #define GNQW_NEXT       0
  21.  
  22. #include "checkord.c"
  23.  
  24. int main() 
  25.     {
  26.     // Ord/name check
  27.     if (! CheckOrdName("GetNextQueueWindow", "USER", 274))
  28.         return 0;
  29.  
  30.     winio_about("GETNEXTQ"
  31.         "\nUses GetNextQueueWindow to walk the z-order"
  32.         "\n\nFrom Chapter 6 of"
  33.         "\n\"Undocumented Windows\" (Addison-Wesley, 1992)"
  34.         "\nby Andrew Schulman, David Maxey and Matt Pietrek"
  35.         );
  36.     
  37.     for (;;)
  38.         {
  39.         printf("Press N or P for Next or Previous window : ");
  40.  
  41.         SwitchToThisWindow(
  42.             GetNextQueueWindow(winio_current(),
  43.                 toupper(getchar()) == 'N' ? GNQW_NEXT : GNQW_PREVIOUS),
  44.             TRUE);
  45.         }
  46.     
  47.     return 0;
  48.     }
  49.