home *** CD-ROM | disk | FTP | other *** search
- /*
- GETNEXTQ.C -- Uses GetNextQueueWindow to walk the window Z order
-
- From Chapter 6 of "Undocumented Windows" (Addison-Wesley 1992)
- by Andrew Schulman, Dave Maxey and Matt Pietrek
-
- Build using: WINIOBC GETNEXTQ (for Borland C++ v3.00)
- WINIOMS GETNEXTQ (for Microsoft C/SDK)
- */
-
- #include <windows.h>
- #include <ctype.h>
- #include "winio.h"
-
- /* undocumented functions */
- extern HANDLE FAR PASCAL GetNextQueueWindow(HWND hwnd, int nWhichWay);
- extern void FAR PASCAL SwitchToThisWindow(HWND hwnd, BOOL tRestore);
-
- #define GNQW_PREVIOUS 1
- #define GNQW_NEXT 0
-
- #include "checkord.c"
-
- int main()
- {
- // Ord/name check
- if (! CheckOrdName("GetNextQueueWindow", "USER", 274))
- return 0;
-
- winio_about("GETNEXTQ"
- "\nUses GetNextQueueWindow to walk the z-order"
- "\n\nFrom Chapter 6 of"
- "\n\"Undocumented Windows\" (Addison-Wesley, 1992)"
- "\nby Andrew Schulman, David Maxey and Matt Pietrek"
- );
-
- for (;;)
- {
- printf("Press N or P for Next or Previous window : ");
-
- SwitchToThisWindow(
- GetNextQueueWindow(winio_current(),
- toupper(getchar()) == 'N' ? GNQW_NEXT : GNQW_PREVIOUS),
- TRUE);
- }
-
- return 0;
- }
-