#pragma once
#include <comdef.h>
/*
inline void TESTHR(HRESULT hr){
if FAILED(hr){
IErrorInfo* pEI;
GetErrorInfo(0,&pEI);
throw _com_error(hr,pEI);
}
}
inline void FormatMessage(HWND hWndParent=::GetActiveWindow(),LPCTSTR caption=_T("Error"))
{
LPVOID lpMsgBuf;
::FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(),
0, // Default language
(LPTSTR) &lpMsgBuf,
0,
NULL
);
// Process any inserts in lpMsgBuf.
// ...
// Display the string.
::MessageBox( hWndParent, (LPCTSTR)lpMsgBuf, "Error", MB_OK | MB_ICONINFORMATION );
// Free the buffer.
LocalFree( lpMsgBuf );
}
*/