home *** CD-ROM | disk | FTP | other *** search
/ Windows Graphics Programming / Feng_Yuan_Win32_GDI_DirectX.iso / Samples / Chapt_03 / QueryTab / QueryTab.cpp next >
Encoding:
C/C++ Source or Header  |  2000-05-17  |  1.9 KB  |  53 lines

  1. //-----------------------------------------------------------------------------------//
  2. //              Windows Graphics Programming: Win32 GDI and DirectDraw               //
  3. //                             ISBN  0-13-086985-6                                   //
  4. //                                                                                   //
  5. //  Written            by  Yuan, Feng                             www.fengyuan.com   //
  6. //  Copyright (c) 2000 by  Hewlett-Packard Company                www.hp.com         //
  7. //  Published          by  Prentice Hall PTR, Prentice-Hall, Inc. www.phptr.com      //
  8. //                                                                                   //
  9. //  FileName   : querytab.cpp                                                         //
  10. //  Description: Query GDI handle table demo, Chapter 3                              //
  11. //  Version    : 1.00.000, May 31, 2000                                              //
  12. //-----------------------------------------------------------------------------------//
  13.  
  14. #define STRICT
  15. #define WIN32_LEAN_AND_MEAN
  16.  
  17. #include <windows.h>
  18. #include "resource.h"
  19.  
  20. int MyMessageBox(HWND hWnd, const TCHAR * text, const TCHAR * caption, DWORD style)
  21. {
  22.     MSGBOXPARAMS param;
  23.  
  24.     memset(& param, 0, sizeof(param));
  25.     param.cbSize      = sizeof(param);
  26.     param.hwndOwner   = hWnd;
  27.     param.hInstance   = GetModuleHandle(NULL);
  28.     param.lpszText    = text;
  29.     param.lpszCaption = caption;
  30.     param.dwStyle     = style | MB_USERICON;
  31.     param.lpszIcon    = MAKEINTRESOURCE(IDI_GRAPH);
  32.  
  33.     return MessageBoxIndirect(¶m);
  34. }
  35.  
  36. typedef unsigned (CALLBACK * Proc0) (void);
  37.  
  38.  
  39. int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
  40. {
  41.     Proc0 p = (Proc0) GetProcAddress(GetModuleHandle("GDI32.DLL"), "GdiQueryTable");
  42.  
  43.     if (p)
  44.     {
  45.         TCHAR temp[32];
  46.  
  47.         wsprintf(temp, "%8lX", p());
  48.         MyMessageBox(NULL, temp, "GdiQueryTable() returns", MB_OK);
  49.     }
  50.  
  51.     return 0;
  52. }
  53.