티스토리 뷰
반응형
#include <windows.h> LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM); HINSTANCE g_hInst; LPCTSTR lpszClass=TEXT("TimerText2"); 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_CROSS); WndClass.hIcon=LoadIcon(NULL,IDI_EXCLAMATION); WndClass.hInstance=hInstance; WndClass.lpfnWndProc=WndProc; WndClass.lpszClassName=lpszClass; WndClass.lpszMenuName=NULL; WndClass.style=CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS; RegisterClass(&WndClass); hWnd=CreateWindow(lpszClass,lpszClass, WS_OVERLAPPEDWINDOW|WS_VSCROLL|WS_HSCROLL, CW_USEDEFAULT,CW_USEDEFAULT,100,300, 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 LPTSTR sText[5] = {TEXT("TimerText2"), TEXT("switch"),TEXT("API"),TEXT("P.113"),TEXT("2009.1.13")}; static int ck=0; static int i=200; switch (iMessage){ case WM_CREATE: SetTimer(hWnd,1,50,NULL); SendMessage(hWnd, WM_TIMER, 1, 0); return 0; case WM_TIMER: switch (wParam){ case 1: if(i==10) { KillTimer(hWnd,1); SetTimer(hWnd,2,1000,NULL); } i-=10; InvalidateRect(hWnd,NULL,TRUE); break; case 2: i=200; SetTimer(hWnd,1,50,NULL); KillTimer(hWnd,2); ck++; if(ck==5) ck=0; break; } return 0; case WM_PAINT: hdc=BeginPaint(hWnd,&ps); TextOut(hdc, 10, i, sText[ck], lstrlen(sText[ck])); EndPaint(hWnd, &ps); return 0; case WM_DESTROY: PostQuitMessage(0); return 0; } return(DefWindowProc(hWnd,iMessage,wParam,lParam)); }
반응형
'Programing > API' 카테고리의 다른 글
API - InfoDlg (0) | 2009.01.19 |
---|---|
API - 키보드 입력 (0) | 2009.01.19 |
API - First (0) | 2009.01.19 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- Programming - C
- Programing
- PSP
- Operation System
- WPF
- 유마일
- V3
- 프로그래밍
- 스터디_발표자료
- WL-54G
- 구글
- 녹화
- 인코더
- c#
- Programming - C / C++
- 데몬
- API 프로그래밍
- GAME
- ffmpeg
- 소니
- 하이퍼큐브
- TCP/IP
- 가상드라이브
- 백신
- KAI
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
글 보관함