LuvSea
API 기본 출력 소스 본문
#include<windows.h>
LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
HINSTANCE g_hInst;
LPCTSTR lpszClass=TEXT("first");
int APIENTRY WinMain(HINSTANCE hInstance,HINSTANCE hPrevlnstance, 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); //주소에 write
//윈도우 생성
hWnd=CreateWindow(TEXT("first"),TEXT("abc"),WS_OVERLAPPEDWINDOW | WS_VSCROLL | WS_HSCROLL |WS_BORDER
,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 IParam)
{
HDC hdc;
PAINTSTRUCT ps;
switch(iMessage)
{
case WM_DESTROY:
PostQuitMessage(0);
return 0;
case WM_RBUTTONDOWN: //우클릭 시
hdc = GetDC(hWnd);
TextOut(hdc,200,200,"beautiful Korea",15);
ReleaseDC(hWnd,hdc);
return 0;
case WM_LBUTTONDOWN: //좌클릭 시
hdc = GetDC(hWnd);
TextOut(hdc,100,200,"beautiful Korea",15);
ReleaseDC(hWnd,hdc);
MessageBeep(2);
return 0;
case WM_PAINT:
hdc = BeginPaint(hWnd,&ps);
SetTextAlign(hdc,TA_UPDATECP);
TextOut(hdc,100,100,TEXT("geegeegeegeegee"),15);
TextOut(hdc,100,120,TEXT("geegeegeegee"),12);
TextOut(hdc,100,140,TEXT("geegeegeegeegeegee"),18);
EndPaint(hWnd,&ps);
return 0;
}
return(DefWindowProc(hWnd,iMessage,WParam,IParam));
}
'sTudy' 카테고리의 다른 글
Message Box (0) | 2009.07.06 |
---|---|
직선, 원, 사각형 그리기 (0) | 2009.07.06 |
텍스트형 LCD 모듈 응용 프로그램을 이용한 사용자 정의문자 출력 (1) | 2009.06.04 |
ARM7TDMI AT91SAM7S256의 H-jtag 설치 및 사용 (0) | 2009.06.01 |
윈도우 기반 리눅스 컴파일 (Cygwin, GNU ARM 설치) (0) | 2009.06.01 |