0001:
0002:
0003:
0004:
0005:
0006: #ifndef DXUTIL_H
0007: #define DXUTIL_H
0008:
0009:
0010:
0011:
0012:
0013: #define SAFE_DELETE(p) { if(p) { delete (p); (p)=NULL; } }
0014: #define SAFE_DELETE_ARRAY(p) { if(p) { delete[] (p); (p)=NULL; } }
0015: #define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=NULL; } }
0016:
0017:
0018:
0019:
0020:
0021:
0022:
0023:
0024:
0025: const TCHAR* DXUtil_GetDXSDKMediaPath();
0026: HRESULT DXUtil_FindMediaFile( TCHAR* strPath, TCHAR* strFilename );
0027:
0028:
0029:
0030:
0031:
0032:
0033:
0034:
0035: HRESULT DXUtil_WriteStringRegKey( HKEY hKey, TCHAR* strRegName, TCHAR* strValue );
0036: HRESULT DXUtil_WriteIntRegKey( HKEY hKey, TCHAR* strRegName, DWORD dwValue );
0037: HRESULT DXUtil_WriteGuidRegKey( HKEY hKey, TCHAR* strRegName, GUID guidValue );
0038: HRESULT DXUtil_WriteBoolRegKey( HKEY hKey, TCHAR* strRegName, BOOL bValue );
0039:
0040: HRESULT DXUtil_ReadStringRegKey( HKEY hKey, TCHAR* strRegName, TCHAR* strValue, DWORD dwLength, TCHAR* strDefault );
0041: HRESULT DXUtil_ReadIntRegKey( HKEY hKey, TCHAR* strRegName, DWORD* pdwValue, DWORD dwDefault );
0042: HRESULT DXUtil_ReadGuidRegKey( HKEY hKey, TCHAR* strRegName, GUID* pGuidValue, GUID& guidDefault );
0043: HRESULT DXUtil_ReadBoolRegKey( HKEY hKey, TCHAR* strRegName, BOOL* pbValue, BOOL bDefault );
0044:
0045:
0046:
0047:
0048:
0049:
0050:
0051:
0052:
0053:
0054:
0055:
0056:
0057:
0058:
0059:
0060: enum TIMER_COMMAND { TIMER_RESET, TIMER_START, TIMER_STOP, TIMER_ADVANCE,
0061: TIMER_GETABSOLUTETIME, TIMER_GETAPPTIME, TIMER_GETELAPSEDTIME };
0062: FLOAT __stdcall DXUtil_Timer( TIMER_COMMAND command );
0063:
0064:
0065:
0066:
0067:
0068:
0069:
0070: VOID DXUtil_ConvertAnsiStringToWide( WCHAR* wstrDestination, const CHAR* strSource, int cchDestChar = -1 );
0071: VOID DXUtil_ConvertWideStringToAnsi( CHAR* strDestination, const WCHAR* wstrSource, int cchDestChar = -1 );
0072: VOID DXUtil_ConvertGenericStringToAnsi( CHAR* strDestination, const TCHAR* tstrSource, int cchDestChar = -1 );
0073: VOID DXUtil_ConvertGenericStringToWide( WCHAR* wstrDestination, const TCHAR* tstrSource, int cchDestChar = -1 );
0074: VOID DXUtil_ConvertAnsiStringToGeneric( TCHAR* tstrDestination, const CHAR* strSource, int cchDestChar = -1 );
0075: VOID DXUtil_ConvertWideStringToGeneric( TCHAR* tstrDestination, const WCHAR* wstrSource, int cchDestChar = -1 );
0076:
0077:
0078:
0079:
0080:
0081:
0082:
0083: VOID DXUtil_ConvertGUIDToString( const GUID* pGuidIn, TCHAR* strOut );
0084: BOOL DXUtil_ConvertStringToGUID( const TCHAR* strIn, GUID* pGuidOut );
0085:
0086:
0087:
0088:
0089:
0090:
0091:
0092: VOID DXUtil_Trace( TCHAR* strMsg, ... );
0093: HRESULT _DbgOut( TCHAR*, DWORD, HRESULT, TCHAR* );
0094:
0095: #if defined(DEBUG) | defined(_DEBUG)
0096: #define DXTRACE DXUtil_Trace
0097: #else
0098: #define DXTRACE sizeof
0099: #endif
0100:
0101: #if defined(DEBUG) | defined(_DEBUG)
0102: #define DEBUG_MSG(str) _DbgOut( __FILE__, (DWORD)__LINE__, 0, str )
0103: #else
0104: #define DEBUG_MSG(str) (0L)
0105: #endif
0106:
0107:
0108:
0109:
0110: #endif
0111: