00001
00002
00003
00004
00005 #include <Windows.h>
00006
00007 #define MSG_ERROR20 "ERROR"
00008 #define MSG_ERROR36 "Error : GetDC fails"
00009 #define MSG_ERROR37 "Error : GetDC Input don't handle NULL"
00010
00011 HDC TryToGetDC(HWND hWnd)
00012 {
00013 HDC hDCRet=NULL;
00014
00015 if (hWnd)
00016 {
00017 hDCRet=GetDC(hWnd);
00018 if (hDCRet == NULL)
00019 {
00020 #ifdef _DEBUG
00021 MessageBox(NULL,MSG_ERROR36,MSG_ERROR20,MB_ICONWARNING);
00022 #endif
00023 }
00024 }
00025 else
00026 {
00027 #ifdef _DEBUG
00028 MessageBox(NULL,MSG_ERROR37,MSG_ERROR20,MB_ICONWARNING);
00029 #endif
00030 }
00031
00032 return (HDC)hDCRet;
00033 }
00034