프로그래밍/조각코드
-
Windows API GetLastError 코드를 문자열로 출력하기프로그래밍/조각코드 2012. 4. 4. 14:22
다음과 같은 코드를 통해서 확인할 수 있다. void ErrorMessageBox(DWORD dwError) { LPVOID lpMsg = NULL; DWORD dwFormat = FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS; DWORD dwLanguage = MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT); if (!FormatMessage(dwFormat, NULL, dwError, dwLanguage, (LPTSTR)&lpMsg, 0, NULL)) { return; } MessageBox(NULL, (LPCTSTR)lpMsg, L"Error", MB_OK..
-
빌드 버전 생성 임시코드프로그래밍/조각코드 2012. 2. 29. 21:30
#define _CRT_SECURE_NO_WARNINGS #include #include #include #include char szComputerName[17] = {0,}; char szUserName[17] = {0,}; void main() { const char* dat_file = "prebuild.dat"; const char* build_file = "build.h"; FILE* fp = NULL; fp = fopen( dat_file, "rb" ); if ( NULL == fp ) { int init_build = 0; fp = fopen( dat_file, "wb" ); fwrite(&init_build, sizeof(int), 1, fp); fclose( fp ); fp = fope..