소프트웨어/Win32

Win32 첫 소스(기본소스)

cs만두 2016. 1. 6. 21:12

김상형 저 Win32 API정복을 참고해서 공부하고있다.


Base가 되는 기본 틀 소스를 작성하였다.

https://github.com/ManSung-Kim/Win32Study/blob/master/StudyWin32/ApiTemplate.cpp


아직 초반이긴한데, Win32도 Android App처럼 생명주기가 있는것을 알고 신기했다. 오오..

WinMain은 최초 설정후 모든 루프는 메시지형태로 WndProc에서 처리된다. 오오..


 
LRESULT CALLBACK WndProc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam) 
{
	HDC hdc; // dc handle
	PAINTSTRUCT ps; // dc paint
	//static char str[256];
	//static LPCTSTR str;
	//static TCHAR str[256];
	//int len;
	switch(iMessage) {
	case WM_CREATE:
		return 0;
	case WM_PAINT:
		hdc=BeginPaint(hWnd,&ps);
		
		EndPaint(hWnd,&ps);
		return 0;
	case WM_DESTROY:
		PostQuitMessage(0);
		return 0;
	}
	return (DefWindowProc(hWnd,iMessage,wParam,lParam));
}