-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefined.h
45 lines (42 loc) · 1.32 KB
/
defined.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <windows.h>
#pragma once
#define IN
#define OUT
#define REF
#define FALSE_MESSAGE_RETURN(x, str) \
if (!(x)) \
{ \
WCHAR szErrorBuffer[MAX_PATH]; \
wsprintfW(szErrorBuffer, L"*ERROR* MESSAGE::%s\n", str); \
MessageBoxW(GetForegroundWindow(), szErrorBuffer, L"Unexpected error encountered", MB_OK | MB_ICONERROR); \
return -1; \
}
#define FALSE_MESSAGE_RETURN_CODE(x, str, failcode) \
if (!(x)) \
{ \
WCHAR szErrorBuffer[MAX_PATH]; \
wsprintfW(szErrorBuffer, L"*ERROR* MESSAGE::%s\n", str); \
MessageBoxW(GetForegroundWindow(), szErrorBuffer, L"Unexpected error encountered", MB_OK | MB_ICONERROR); \
return failcode; \
}
#define FAILED_MESSAGE_RETURN(x, str) \
if (((HRESULT)(x)) < 0) \
{ \
WCHAR szErrorBuffer[MAX_PATH]; \
wsprintfW(szErrorBuffer, L"*ERROR* MESSAGE::%s\n", str); \
MessageBoxW(GetForegroundWindow(), szErrorBuffer, L"Unexpected error encountered", MB_OK | MB_ICONERROR); \
return (HRESULT)(x); \
}
#define FAILED_MESSAGE_RETURN_CODE(x, str, failcode) \
if (((HRESULT)(x)) < 0) \
{ \
WCHAR szErrorBuffer[MAX_PATH]; \
wsprintfW(szErrorBuffer, L"*ERROR* MESSAGE::%s\n", str); \
MessageBoxW(GetForegroundWindow(), szErrorBuffer, L"Unexpected error encountered", MB_OK | MB_ICONERROR); \
return failcode; \
}
#define FAILED_RETURN(hr) \
if (FAILED(hr)) \
{ \
return hr; \
}