MsgBox(_ltoa(GetLastError(),str,16)); HWND hWid; void MsgBox(char* msg) { MessageBox(hWid,msg,msg,0); } This would display the errocode returned by the GetLastError Function.