home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / pc / Source / GPCHAP15 / PROG15_3.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  2002-04-29  |  1.6 KB  |  61 lines

  1.  
  2. // PROG15_3.CPP - DirectSetup version detection demo
  3.  
  4. // INCLUDES ///////////////////////////////////////////////
  5.  
  6. #define WIN32_LEAN_AND_MEAN  
  7. #define INITGUID
  8.  
  9. #include <windows.h>   // include important windows stuff
  10. #include <windowsx.h> 
  11. #include <mmsystem.h>
  12. #include <iostream.h> // include important C/C++ stuff
  13. #include <conio.h>
  14. #include <stdlib.h>
  15. #include <malloc.h>
  16. #include <memory.h>
  17. #include <string.h>
  18. #include <stdarg.h>
  19. #include <stdio.h> 
  20. #include <math.h>
  21. #include <io.h>
  22. #include <fcntl.h>
  23. #include <dsetup.h>
  24.  
  25. // WINMAIN ////////////////////////////////////////////////
  26.  
  27. int WINAPI WinMain(    HINSTANCE hinstance,
  28.                     HINSTANCE hprevinstance,
  29.                     LPSTR lpcmdline,
  30.                     int ncmdshow)
  31. {
  32. // this is a very simple version detector
  33.  
  34. DWORD version;    // used to hold version information
  35. DWORD revision;   // used to hold revision information
  36. char buffer[256]; // used to hold messages
  37.  
  38. // test if directX is installed, if so then print out
  39. // verison and revision, otherwise print out error
  40. if (DirectXSetupGetVersion(&version, &revision))
  41.    {
  42.    // build up message
  43.    sprintf(buffer,"DirectX version is %d.%d.%d.%d\n",
  44.                   HIWORD(version), LOWORD(version),
  45.                   HIWORD(revision), LOWORD(revision));
  46.  
  47.    // display a message box with the info
  48.    MessageBox(NULL,buffer,
  49.               "DirectX Setup Version Demo",MB_OK);
  50.  
  51.    } // end if
  52. else
  53.    MessageBox(NULL,"Previous Versions of DirectX not Installed!",
  54.               "DirectX Setup Version Demo",MB_OK);
  55.  
  56. // return to Windows like this
  57. return(0);
  58.  
  59. } // end WinMain
  60.  
  61.