700 컴퓨터/704 VC++
VC++ 윈메인 Starting Point
yyht
2010. 8. 5. 17:14
#define UNICODE // 유니코드 자동매크로를 사용하겠다는 의미 #include <windows.h> #include <fstream> // fopen 함수 선언 #include <locale.h> #include <tchar.h> // Wide Char와 Multy Char사이의 매크로가 선언되어 있음 #include "resource.h" #include <string.h> #pragma setlocale (".ACP") //using namespace std; HINSTANCE hInst; int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdParam, int nCmdShow) { HWND hWnd; MSG Message; WNDCLASS WndClass; hInst = hInstance; int x, y; LPCTSTR lpszClass = L"Young 통합 치트모드 1.4 설치"; //윈도우 이름 및 타이틀바에 등록할 문자열 //------------ 아래 부분은 윈도우 클래스를 설정해주는 것이다. -------------------- WndClass.cbClsExtra = 0; WndClass.cbWndExtra = 0; WndClass.hbrBackground = (HBRUSH)GetStockObject(GRAY_BRUSH); WndClass.hCursor = LoadCursor(NULL,IDC_ARROW); WndClass.hIcon = LoadIcon(NULL,IDI_APPLICATION); WndClass.hInstance = hInstance; WndClass.lpfnWndProc = WndProc; WndClass.lpszClassName = lpszClass; WndClass.lpszMenuName = NULL; WndClass.style = CS_HREDRAW | CS_VREDRAW; //------------ 위 부분은 윈도우 클래스를 설정해주는 곳이다. -------------------- RegisterClass(&WndClass); // <-- 여기서는 위에서 설정한 클래스를 등록한다. // 설정하고 등록한 윈도우를 생성한다. hWnd = CreateWindow(lpszClass,lpszClass,WS_OVERLAPPEDWINDOW, NULL,NULL,NULL,NULL,NULL,(HMENU)NULL,hInstance,NULL); //생성한 윈도우를 출력..(이 함수를 호출하지않으면 윈도우가 보이지 않는다.) ShowWindow(hWnd,nCmdShow); while(GetMessage(&Message,NULL,0,0)) //사용자가 종료하기 전까지 반복해서 메세지 처리를 호출한다. { TranslateMessage(&Message); DispatchMessage(&Message); } return (int)Message.wParam; } LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam) //여기서 실제로 메시지를 처리한다. { switch(iMsg) { case WM_CREATE: _wsetlocale(LC_ALL, L".ACP"); //L"ko_KR.UTF-8"); GetCurrentDirectory(MAX_PATH, SetupFolder); return TRUE; break; case WM_LBUTTONDOWN: return TRUE; break; case WM_DESTROY: PostQuitMessage(0); return TRUE; } //프로그래머가 처리하지 않은 나머지 동작을 기본처리로 넘긴다. return DefWindowProc(hWnd,iMsg,wParam,lParam); }