Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

dxutil.h

Go to the documentation of this file.
00001 //----------------------------------------------------------------------------- 00002 // File: DXUtil.h 00003 // 00004 // Desc: Helper functions and typing shortcuts for DirectX programming. 00005 // 00006 // Copyright (c) 1997-2000 Microsoft Corporation. All rights reserved 00007 //----------------------------------------------------------------------------- 00008 #ifndef DXUTIL_H 00009 #define DXUTIL_H 00010 00011 00012 //----------------------------------------------------------------------------- 00013 // Miscellaneous helper functions 00014 //----------------------------------------------------------------------------- 00015 #define SAFE_DELETE(p) { if(p) { delete (p); (p)=NULL; } } 00016 #define SAFE_DELETE_ARRAY(p) { if(p) { delete[] (p); (p)=NULL; } } 00017 #define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=NULL; } } 00018 00019 00020 00021 00022 //----------------------------------------------------------------------------- 00023 // Name: DXUtil_GetDXSDKMediaPath() and DXUtil_FindMediaFile() 00024 // Desc: Returns the DirectX SDK path, as stored in the system registry 00025 // during the SDK install. 00026 //----------------------------------------------------------------------------- 00027 const TCHAR* DXUtil_GetDXSDKMediaPath(); 00028 HRESULT DXUtil_FindMediaFile( TCHAR* strPath, TCHAR* strFilename ); 00029 00030 00031 00032 00033 //----------------------------------------------------------------------------- 00034 // Name: DXUtil_Read*RegKey() and DXUtil_Write*RegKey() 00035 // Desc: Helper functions to read/write a string registry key 00036 //----------------------------------------------------------------------------- 00037 HRESULT DXUtil_WriteStringRegKey( HKEY hKey, TCHAR* strRegName, TCHAR* strValue ); 00038 HRESULT DXUtil_WriteIntRegKey( HKEY hKey, TCHAR* strRegName, DWORD dwValue ); 00039 HRESULT DXUtil_WriteGuidRegKey( HKEY hKey, TCHAR* strRegName, GUID guidValue ); 00040 HRESULT DXUtil_WriteBoolRegKey( HKEY hKey, TCHAR* strRegName, BOOL bValue ); 00041 00042 HRESULT DXUtil_ReadStringRegKey( HKEY hKey, TCHAR* strRegName, TCHAR* strValue, DWORD dwLength, TCHAR* strDefault ); 00043 HRESULT DXUtil_ReadIntRegKey( HKEY hKey, TCHAR* strRegName, DWORD* pdwValue, DWORD dwDefault ); 00044 HRESULT DXUtil_ReadGuidRegKey( HKEY hKey, TCHAR* strRegName, GUID* pGuidValue, GUID& guidDefault ); 00045 HRESULT DXUtil_ReadBoolRegKey( HKEY hKey, TCHAR* strRegName, BOOL* pbValue, BOOL bDefault ); 00046 00047 00048 00049 00050 //----------------------------------------------------------------------------- 00051 // Name: DXUtil_Timer() 00052 // Desc: Performs timer opertations. Use the following commands: 00053 // TIMER_RESET - to reset the timer 00054 // TIMER_START - to start the timer 00055 // TIMER_STOP - to stop (or pause) the timer 00056 // TIMER_ADVANCE - to advance the timer by 0.1 seconds 00057 // TIMER_GETABSOLUTETIME - to get the absolute system time 00058 // TIMER_GETAPPTIME - to get the current time 00059 // TIMER_GETELAPSEDTIME - to get the time that elapsed between 00060 // TIMER_GETELAPSEDTIME calls 00061 //----------------------------------------------------------------------------- 00062 enum TIMER_COMMAND { TIMER_RESET, TIMER_START, TIMER_STOP, TIMER_ADVANCE, 00063 TIMER_GETABSOLUTETIME, TIMER_GETAPPTIME, TIMER_GETELAPSEDTIME }; 00064 FLOAT __stdcall DXUtil_Timer( TIMER_COMMAND command ); 00065 00066 00067 00068 00069 //----------------------------------------------------------------------------- 00070 // UNICODE support for converting between CHAR, TCHAR, and WCHAR strings 00071 //----------------------------------------------------------------------------- 00072 VOID DXUtil_ConvertAnsiStringToWide( WCHAR* wstrDestination, const CHAR* strSource, int cchDestChar = -1 ); 00073 VOID DXUtil_ConvertWideStringToAnsi( CHAR* strDestination, const WCHAR* wstrSource, int cchDestChar = -1 ); 00074 VOID DXUtil_ConvertGenericStringToAnsi( CHAR* strDestination, const TCHAR* tstrSource, int cchDestChar = -1 ); 00075 VOID DXUtil_ConvertGenericStringToWide( WCHAR* wstrDestination, const TCHAR* tstrSource, int cchDestChar = -1 ); 00076 VOID DXUtil_ConvertAnsiStringToGeneric( TCHAR* tstrDestination, const CHAR* strSource, int cchDestChar = -1 ); 00077 VOID DXUtil_ConvertWideStringToGeneric( TCHAR* tstrDestination, const WCHAR* wstrSource, int cchDestChar = -1 ); 00078 00079 00080 00081 00082 //----------------------------------------------------------------------------- 00083 // Debug printing support 00084 //----------------------------------------------------------------------------- 00085 VOID DXUtil_Trace( TCHAR* strMsg, ... ); 00086 HRESULT _DbgOut( TCHAR*, DWORD, HRESULT, TCHAR* ); 00087 00088 #if defined(DEBUG) | defined(_DEBUG) 00089 #define DXTRACE DXUtil_Trace 00090 #else 00091 #define DXTRACE sizeof 00092 #endif 00093 00094 #if defined(DEBUG) | defined(_DEBUG) 00095 #define DEBUG_MSG(str) _DbgOut( __FILE__, (DWORD)__LINE__, 0, str ) 00096 #else 00097 #define DEBUG_MSG(str) (0L) 00098 #endif 00099 00100 00101 00102 00103 #endif // DXUTIL_H

Generated on Fri May 21 19:22:36 2004 for LIBELL by doxygen 1.3.7