소스
#include <windows.h>
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
HINSTANCE g_hInst;
LPCTSTR lpszClass = TEXT("KIJOON");
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpszCmdParam, int nCmdShow)
{
HWND hWnd;
MSG Message;
WNDCLASS WndClass;
g_hInst = hInstance;
WndClass.cbClsExtra = 0;
WndClass.cbWndExtra = 0;
WndClass.hbrBackground = (HBRUSH)GetStockObject(WHITE_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,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
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 iMessage, WPARAM wParam, LPARAM lParam)
{
HDC hdc;
PAINTSTRUCT ps;
static TCHAR str[256];
int len;
CONST RECT lpRect = {100, 100, 1300, 120};
switch (iMessage)
{
case WM_DESTROY:
PostQuitMessage(0);
return 0;
case WM_CHAR :
len = lstrlen(str);
str[len] = (TCHAR)wParam;
str[len + 1] = 0;
InvalidateRect(hWnd, &lpRect, TRUE);
return 0;
case WM_PAINT :
hdc = BeginPaint(hWnd, &ps);
TextOut(hdc, 100, 100, str, lstrlen(str));
if(255 == lstrlen(str))
{
str[0] = 0;
}
EndPaint(hWnd, &ps);
return 0;
}
return (DefWindowProc(hWnd, iMessage, wParam, lParam));
}
실행결과
'코스웨어 > 13년 스마트컨트롤러' 카테고리의 다른 글
context 프로젝트_한성원 (0) | 2013.10.02 |
---|---|
2013년 10월 2일 어셈블리 실습과제 - 김경순 (0) | 2013.10.02 |
API 숙제 -1002 손초롱 (0) | 2013.10.02 |
CONTEXT SWITCHING 프로젝트 -1002 임기준 (0) | 2013.10.02 |
20131002 어셈블리 -서준영 (0) | 2013.10.02 |
20131002 ASSEMBLY - 전영기 (0) | 2013.10.02 |
메모리,레지스터 프로그램 (0) | 2013.10.02 |
131002 수 _ 어셈블리 김성엽 (0) | 2013.10.02 |