/*
2011년 03월 19일 (토)
Windows API WIn32 Project 의 기초 코드를 최대한 줄인 게시글입니다.
API의 기본구조는 C Language 이지만, 사용 파일은 CPP입니다.
VCC 2008 > Win32 프로젝트 > ALT+F7 > 구성 속성(탭) > C/C++(탭)
> 미리 컴파일된 헤더 > 미리 컴파일된 헤더 만들기/사용 > 미리 컴파일된 헤더 사용 안함
을 선택해 주시기 바랍니다.
*/
#include <windows.h>
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) {
MSG msg;
WNDCLASS wcex;
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = NULL;
wcex.lpszClassName = TEXT("2011.03.19");
RegisterClass(&wcex);
HWND hWnd;
hWnd = CreateWindow( TEXT("2011.03.19"), TEXT("Default"), WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
if (!hWnd){ return 0; }
ShowWindow(hWnd, nCmdShow);
while (GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return (int) msg.wParam;
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam){
PAINTSTRUCT ps;
HDC hdc;
switch (message){
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
EndPaint(hWnd, &ps);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
댓글 0
번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|
» | [API] 기초 코드 | simpled | 2013.06.23 | 9796 |
67 | [MFC] 한글 파일 입출력 | simpled | 2013.06.24 | 9990 |
66 | [MFC] 한글 파일 출력 | simpled | 2013.06.24 | 7149 |
65 |
[API] 발표 자료
![]() | simpled | 2013.06.23 | 6555 |
64 |
[API] Drag&Drop2
![]() | simpled | 2013.06.23 | 6491 |
63 |
[API] 기말 과제
![]() | simpled | 2013.06.23 | 7104 |
62 | [API] 프로젝트 경로 리턴 함수 (비공개) | simpled | 2013.06.23 | 6814 |
61 | [API] 파일 조작 관련된 좋은 함수들 | simpled | 2013.06.23 | 6518 |
60 |
[API] Drag&Drop
![]() | simpled | 2013.06.23 | 6787 |
59 |
[API] 로딩 화면(팝업(popup)) 완성 - 2
![]() | simpled | 2013.06.23 | 6051 |
58 |
[API] 로딩 화면(팝업(popup)) 완성 - 1
![]() | simpled | 2013.06.23 | 6069 |
57 |
[API] 로딩 화면(팝업(popup)) 기획
![]() | simpled | 2013.06.23 | 6389 |
56 |
[API] 제목 표시줄 없애기
![]() | simpled | 2013.06.23 | 6571 |
55 | [API] Alt+F4 막기 | simpled | 2013.06.23 | 7290 |
54 |
[API] Project : SimplePaint v4.0
![]() | simpled | 2013.06.23 | 6200 |
53 |
[API] Project : SimplePaint v1.0
![]() | simpled | 2013.06.23 | 6795 |
52 |
[API] DialogBox
![]() | simpled | 2013.06.23 | 6929 |
51 | [API] Static | simpled | 2013.06.23 | 6353 |
50 | [API] ScrollBar | simpled | 2013.06.23 | 6322 |
49 |
[API] ComboBox
![]() | simpled | 2013.06.23 | 6835 |
48 |
[API] ListBox
![]() | simpled | 2013.06.23 | 7465 |