티스토리 뷰
#include <windows.h>
LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);
HINSTANCE g_hInst;
LPSTR lpszClass="Mouse";
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)WndProc;
WndClass.lpszClassName=lpszClass;
WndClass.lpszMenuName=NULL;
WndClass.style=CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
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,0,0,0)) {
TranslateMessage(&Message);
DispatchMessage(&Message);
}
return Message.wParam;
}
LRESULT CALLBACK WndProc(HWND hWnd,UINT iMessage,WPARAM wParam,LPARAM lParam)
{
HDC hdc;
static int x;
static int y;
static BOOL bnowDraw=FALSE;
switch(iMessage) {
case WM_LBUTTONDOWN:
x=LOWORD(lParam);
y=HIWORD(lParam);
bnowDraw=TRUE;
return 0;
case WM_MOUSEMOVE:
if (bnowDraw==TRUE) {
hdc=GetDC(hWnd);
MoveToEx(hdc,x,y,NULL);
x=LOWORD(lParam);
y=HIWORD(lParam);
LineTo(hdc,x,y);
ReleaseDC(hWnd,hdc);
}
return 0;
case WM_LBUTTONUP:
bnowDraw=FALSE;
return 0;
case WM_LBUTTONDBLCLK:
InvalidateRect(hWnd, NULL, TRUE);
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return(DefWindowProc(hWnd,iMessage,wParam,lParam));
}
'기억하자정보 > 기타' 카테고리의 다른 글
[관리방어] 8. checksum값을 이용한 백도어 검출 문제 (0) | 2006.10.10 |
---|---|
[관리방어] 11.패스워드 설정 문제 (0) | 2006.10.10 |
IEEE 754 소스 (0) | 2006.09.26 |
R6002 - floating point not loaded (0) | 2006.09.25 |
자료형과 2에 대한 보수(2's complement) (0) | 2006.09.25 |
- 안내
- 궁금한 점을 댓글로 남겨주시면 답변해 드립니다.