This reference page is linked to from the following overview topics: SDK Change Details.
#include "utilexp.h"
#include "strbasic.h"
#include "BuildWarnings.h"
#include <wtypes.h>
#include <cmath>
#include <cstdlib>
Go to the source code of this file.
Defines |
|
#define | DL_STDEXT stdext |
#define | DL_NON_RTTI_OBJECT std::__non_rtti_object |
#define | DL_TYPENAME_OUTSIDE_TEMPLATE typename |
Typedefs |
|
typedef INT_PTR(CALLBACK * | DL_NOTQUITE_WNDPROC )(HWND, UINT, WPARAM, LPARAM) |
Enumerations |
|
enum | { FNV1_32_INIT = 0x811c9dc5, FNV_32_PRIME = 0x01000193 } |
Functions |
|
template<typename DataPtr > | |
DataPtr | DLGetWindowLongPtr (HWND hWnd, int n=GWLP_USERDATA, DataPtr=NULL) |
template<typename DataPtr > | |
DataPtr | DLGetWindowLongPtr (HWND hWnd, DataPtr *pPtr, int n=GWLP_USERDATA) |
template<> | |
bool | DLGetWindowLongPtr (HWND hWnd, int n, bool) |
WNDPROC | DLGetWindowProc (HWND hWnd) |
HINSTANCE | DLGetWindowInstance (HWND hWnd) |
template<typename Type > | |
Type | DLSetWindowLongPtr (HWND hWnd, Type ptr, int n=GWLP_USERDATA) |
template<> | |
bool | DLSetWindowLongPtr (HWND hWnd, bool bo, int n) |
WNDPROC | DLSetWindowLongPtr (HWND hWnd, WNDPROC pfn) |
WNDPROC | DLSetWindowProc (HWND hWnd, WNDPROC pfn) |
template<typename DataPtr > | |
DataPtr | DLGetClassLongPtr (HWND hWnd, int n, DataPtr=NULL) |
template<typename DataPtr > | |
DataPtr | DLGetClassLongPtr (HWND hWnd, DataPtr *pPtr, int n) |
template<> | |
bool | DLGetClassLongPtr (HWND hWnd, int n, bool) |
WNDPROC | DLGetClassWindowProc (HWND hWnd) |
template<typename Type > | |
Type | DLSetClassLongPtr (HWND hWnd, Type ptr, int n) |
template<> | |
bool | DLSetClassLongPtr (HWND hWnd, bool bo, int n) |
UtilExport LONG | DLRegSetString (HKEY key, const MCHAR *lpValue, const MCHAR *lpValueName=NULL) |
UtilExport LONG | DLRegSetDWord (HKEY key, DWORD dw, const MCHAR *lpValueName=NULL) |
template<typename BlobType > | |
LONG | DLRegSetBlob (HKEY key, const BlobType *lpbValue, DWORD n, LPCMSTR lpValueName=NULL) |
UtilExport BOOL | DLGetTextExtent (HDC hDC, const MCHAR *text, LPSIZE lpExtent) |
UtilExport BOOL | DLGetTextExtent (HDC hDC, const MCHAR *text, size_t len, LPSIZE lpExtent) |
UtilExport BOOL | DLTextOut (HDC hDC, int x, int y, const MCHAR *text) |
UtilExport BOOL | DLTextOut (HDC hDC, int x, int y, const MCHAR *text, size_t len) |
UtilExport LONG | DLTabbedTextOut (HDC hDC, int x, int y, const MCHAR *text, int nTabs, const INT *pTabPositions, int nTabOrigin) |
UtilExport int | DLDrawText (HDC hDC, MCHAR *lpString, LPRECT lpRect, UINT uFormat) |
UtilExport int | DLDrawText (HDC hDC, MCHAR *lpString, size_t len, LPRECT lpRect, UINT uFormat) |
WORD | PointerHiPart (ULONG_PTR ptr) |
WORD | PointerLoPart (ULONG_PTR ptr) |
WORD | PointerHiPart (LONG_PTR ptr) |
WORD | PointerLoPart (LONG_PTR ptr) |
WORD | PointerHiPart (void *ptr) |
WORD | PointerLoPart (void *ptr) |
unsigned int | fnv_32_buf (const void *buf, int len, unsigned int hval) |
template<typename T > | |
unsigned int | DLObjectHash (T &t, int HashTableSize=0) |
unsigned int | DLPointerHash (const void *pv, int HashTableSize=0) |
int | DL_abs (int n) |
__int64 | DL_abs (__int64 n) |
float | DL_abs (float f) |
double | DL_abs (double f) |
long double | DL_abs (long double f) |
#define DL_STDEXT stdext |
Definition at line 423 of file 3dsmaxport.h.
#define DL_NON_RTTI_OBJECT std::__non_rtti_object |
Definition at line 425 of file 3dsmaxport.h.
#define DL_TYPENAME_OUTSIDE_TEMPLATE typename |
Definition at line 431 of file 3dsmaxport.h.
typedef INT_PTR(CALLBACK* DL_NOTQUITE_WNDPROC)(HWND, UINT, WPARAM, LPARAM) |
Definition at line 114 of file 3dsmaxport.h.
anonymous enum |
Definition at line 342 of file 3dsmaxport.h.
{ FNV1_32_INIT = 0x811c9dc5, FNV_32_PRIME = 0x01000193 };
DataPtr DLGetWindowLongPtr | ( | HWND | hWnd, |
int | n = GWLP_USERDATA , |
||
DataPtr | = NULL |
||
) |
Definition at line 52 of file 3dsmaxport.h.
{ return (DataPtr)(static_cast<LONG_PTR>(::GetWindowLongPtr(hWnd, n))); }
DataPtr DLGetWindowLongPtr | ( | HWND | hWnd, |
DataPtr * | pPtr, | ||
int | n =
GWLP_USERDATA |
||
) |
Definition at line 57 of file 3dsmaxport.h.
{
*pPtr = DLGetWindowLongPtr<DataPtr>(hWnd, n);
return *pPtr;
}
bool DLGetWindowLongPtr | ( | HWND | hWnd, |
int | n, | ||
bool | |||
) | [inline] |
Definition at line 64 of file 3dsmaxport.h.
{ // Specialize for bool so we can quietly deal // warning C4800: 'LONG_PTR' : forcing value to bool 'true' or 'false' (performance warning) return ::GetWindowLongPtr(hWnd, n) != 0; }
WNDPROC DLGetWindowProc | ( | HWND | hWnd | ) | [inline] |
Definition at line 71 of file 3dsmaxport.h.
{
return DLGetWindowLongPtr<WNDPROC>(hWnd, GWLP_WNDPROC);
}
HINSTANCE DLGetWindowInstance | ( | HWND | hWnd | ) | [inline] |
Definition at line 76 of file 3dsmaxport.h.
{
return DLGetWindowLongPtr<HINSTANCE>(hWnd, GWLP_HINSTANCE);
}
Type DLSetWindowLongPtr | ( | HWND | hWnd, |
Type | ptr, | ||
int | n =
GWLP_USERDATA |
||
) | [inline] |
Definition at line 85 of file 3dsmaxport.h.
{ #if !defined( _WIN64 ) // SetWindowLongPtr() maps to SetWindowLong() in 32 bit land; react accordingly to keep // the compiler happy, even with /Wp64. return (Type)(static_cast<LONG_PTR>(::SetWindowLongPtr(hWnd, n, (LONG)((LONG_PTR)(ptr))))); #else return (Type)(static_cast<LONG_PTR>(::SetWindowLongPtr(hWnd, n, (LONG_PTR)(ptr)))); #endif }
bool DLSetWindowLongPtr | ( | HWND | hWnd, |
bool | bo, | ||
int | n | ||
) | [inline] |
Definition at line 96 of file 3dsmaxport.h.
{ // Specialize for bool so we can quietly deal // warning C4800: 'LONG_PTR' : forcing value to bool 'true' or 'false' (performance warning) return ::SetWindowLongPtr(hWnd, n, bo) != 0; }
WNDPROC DLSetWindowLongPtr | ( | HWND | hWnd, |
WNDPROC | pfn | ||
) | [inline] |
Definition at line 103 of file 3dsmaxport.h.
{
return DLSetWindowLongPtr<WNDPROC>(hWnd, pfn, GWLP_WNDPROC);
}
WNDPROC DLSetWindowProc | ( | HWND | hWnd, |
WNDPROC | pfn | ||
) | [inline] |
Definition at line 108 of file 3dsmaxport.h.
{
return DLSetWindowLongPtr<WNDPROC>(hWnd, pfn, GWLP_WNDPROC);
}
DataPtr DLGetClassLongPtr | ( | HWND | hWnd, |
int | n, | ||
DataPtr | = NULL |
||
) |
Definition at line 121 of file 3dsmaxport.h.
{ return (DataPtr)(static_cast<LONG_PTR>(::GetClassLongPtr(hWnd, n))); }
DataPtr DLGetClassLongPtr | ( | HWND | hWnd, |
DataPtr * | pPtr, | ||
int | n | ||
) |
Definition at line 126 of file 3dsmaxport.h.
{
*pPtr = DLGetClassLongPtr<DataPtr>(hWnd, n);
return *pPtr;
}
bool DLGetClassLongPtr | ( | HWND | hWnd, |
int | n, | ||
bool | |||
) | [inline] |
Definition at line 133 of file 3dsmaxport.h.
{ return ::GetClassLongPtr(hWnd, n) != 0; }
WNDPROC DLGetClassWindowProc | ( | HWND | hWnd | ) | [inline] |
Definition at line 138 of file 3dsmaxport.h.
{
return DLGetClassLongPtr<WNDPROC>(hWnd, GCLP_WNDPROC);
}
Type DLSetClassLongPtr | ( | HWND | hWnd, |
Type | ptr, | ||
int | n | ||
) | [inline] |
Definition at line 143 of file 3dsmaxport.h.
{ #if !defined( _WIN64 ) // SetClassLongPtr() maps to SetClassLong() in 32 bit land; react accordingly to keep // the compiler happy, even with /Wp64. return (Type)(static_cast<LONG_PTR>(::SetClassLongPtr(hWnd, n, (LONG)((LONG_PTR)(ptr))))); #else return (Type)(static_cast<LONG_PTR>(::SetClassLongPtr(hWnd, n, (LONG_PTR)(ptr)))); #endif }
bool DLSetClassLongPtr | ( | HWND | hWnd, |
bool | bo, | ||
int | n | ||
) | [inline] |
Definition at line 154 of file 3dsmaxport.h.
{ // Specialize for bool so we can quietly deal // warning C4800: 'LONG_PTR' : forcing value to bool 'true' or 'false' (performance warning) return ::SetClassLongPtr(hWnd, n, bo) != 0; }
UtilExport LONG DLRegSetString | ( | HKEY | key, |
const MCHAR * | lpValue, | ||
const MCHAR * | lpValueName =
NULL |
||
) |
UtilExport LONG DLRegSetDWord | ( | HKEY | key, |
DWORD | dw, | ||
const MCHAR * | lpValueName =
NULL |
||
) |
LONG DLRegSetBlob | ( | HKEY | key, |
const BlobType * | lpbValue, | ||
DWORD | n, | ||
LPCMSTR | lpValueName =
NULL |
||
) | [inline] |
Definition at line 193 of file 3dsmaxport.h.
{
return ::RegSetValueEx(key, lpValueName, 0, REG_BINARY,
reinterpret_cast<LPBYTE>(const_cast<BlobType*>(lpbValue)),
n * sizeof(BlobType));
}
UtilExport BOOL DLGetTextExtent | ( | HDC | hDC, |
const MCHAR * | text, | ||
LPSIZE | lpExtent | ||
) |
UtilExport BOOL DLGetTextExtent | ( | HDC | hDC, |
const MCHAR * | text, | ||
size_t | len, | ||
LPSIZE | lpExtent | ||
) |
UtilExport BOOL DLTextOut | ( | HDC | hDC, |
int | x, | ||
int | y, | ||
const MCHAR * | text | ||
) |
UtilExport BOOL DLTextOut | ( | HDC | hDC, |
int | x, | ||
int | y, | ||
const MCHAR * | text, | ||
size_t | len | ||
) |
UtilExport LONG DLTabbedTextOut | ( | HDC | hDC, |
int | x, | ||
int | y, | ||
const MCHAR * | text, | ||
int | nTabs, | ||
const INT * | pTabPositions, | ||
int | nTabOrigin | ||
) |
UtilExport int DLDrawText | ( | HDC | hDC, |
MCHAR * | lpString, | ||
LPRECT | lpRect, | ||
UINT | uFormat | ||
) |
UtilExport int DLDrawText | ( | HDC | hDC, |
MCHAR * | lpString, | ||
size_t | len, | ||
LPRECT | lpRect, | ||
UINT | uFormat | ||
) |
WORD PointerHiPart | ( | ULONG_PTR | ptr | ) | [inline] |
Definition at line 260 of file 3dsmaxport.h.
{ return static_cast<WORD>(ptr >> 16); }
WORD PointerLoPart | ( | ULONG_PTR | ptr | ) | [inline] |
Definition at line 265 of file 3dsmaxport.h.
{ return static_cast<WORD>(ptr); }
WORD PointerHiPart | ( | LONG_PTR | ptr | ) | [inline] |
Definition at line 270 of file 3dsmaxport.h.
{ return static_cast<WORD>((ptr >> 16) & 0xffff); }
WORD PointerLoPart | ( | LONG_PTR | ptr | ) | [inline] |
Definition at line 275 of file 3dsmaxport.h.
{ return static_cast<WORD>(ptr & 0xffff); }
WORD PointerHiPart | ( | void * | ptr | ) | [inline] |
Definition at line 280 of file 3dsmaxport.h.
{ return PointerHiPart(reinterpret_cast<ULONG_PTR>(ptr)); }
WORD PointerLoPart | ( | void * | ptr | ) | [inline] |
Definition at line 285 of file 3dsmaxport.h.
{ return PointerLoPart(reinterpret_cast<ULONG_PTR>(ptr)); }
unsigned int fnv_32_buf | ( | const void * | buf, |
int | len, | ||
unsigned int | hval | ||
) | [inline] |
Definition at line 366 of file 3dsmaxport.h.
{ const unsigned char *bp = (const unsigned char *)buf; /* start of buffer */ const unsigned char *be = bp + len; /* beyond end of buffer */ /* * FNV-1 hash each octet in the buffer */ while (bp < be) { /* multiply by the 32 bit FNV magic prime mod 2^32 */ hval *= FNV_32_PRIME; /* xor the bottom with the current octet */ hval ^= (unsigned int)*bp++; } /* return our new hash value */ return hval; }
unsigned int DLObjectHash | ( | T & | t, |
int | HashTableSize =
0 |
||
) | [inline] |
Definition at line 388 of file 3dsmaxport.h.
{ // Since we're always hashing single objects, we hash using the 'init value'; // we'd have to carry it over if we were hashing all fields in a structure, for // instance. // You should never never never never attempt to hash a structure by passing its // pointer, since you'd end up hashing the padding bytes as well, which are definitely // not going to be preserved. unsigned int hash = fnv_32_buf(&t, sizeof(t), (unsigned int)FNV1_32_INIT); return HashTableSize ? hash % HashTableSize : hash; }
unsigned int DLPointerHash | ( | const void * | pv, |
int | HashTableSize =
0 |
||
) | [inline] |
Definition at line 401 of file 3dsmaxport.h.
{ return DLObjectHash(pv, HashTableSize); }
int DL_abs | ( | int | n | ) | [inline] |
__int64 DL_abs | ( | __int64 | n | ) | [inline] |
Definition at line 414 of file 3dsmaxport.h.
{ return (n < 0) ? -n : n; }
float DL_abs | ( | float | f | ) | [inline] |
double DL_abs | ( | double | f | ) | [inline] |
long double DL_abs | ( | long double | f | ) | [inline] |