getD3DXVer.cpp 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2012 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22. //-----------------------------------------------------------------------------
  23. // getD3DXVer.exe
  24. //
  25. // Checks for the existance of the correct D3DX library. Automatically
  26. // uses the D3DX library version this executable was compiled against.
  27. // (As contained in D3dx9core.h)
  28. //-----------------------------------------------------------------------------
  29. #include "stdafx.h"
  30. #include <D3dx9core.h>
  31. #include <windows.h>
  32. int _tmain(int argc, _TCHAR* argv[])
  33. {
  34. // Method documented at http://msdn.microsoft.com/en-us/library/bb172717(VS.85).aspx
  35. // NOTE: Went with a different check below as this one requires linking with
  36. // the correct D3DX library to begin with.
  37. //if ( !D3DXCheckVersion(D3D_SDK_VERSION, D3DX_SDK_VERSION) )
  38. //{
  39. // return 1;
  40. //}
  41. // Perform a simple LoadLibrary to check for the correct D3DX
  42. _TCHAR name[64];
  43. _stprintf(name, _T("d3dx9_%d.dll"), D3DX_SDK_VERSION);
  44. HINSTANCE hinstLib = LoadLibrary(name);
  45. if( !hinstLib )
  46. {
  47. //_tprintf(_T("'%s' lib NOT found"), name);
  48. return 1;
  49. }
  50. FreeLibrary(hinstLib);
  51. //_tprintf(_T("'%s' lib was found"), name);
  52. return 0;
  53. }