티스토리 뷰
반응형
#include <windows.h> #include "resource.h" LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM); HINSTANCE g_hInst; HWND hWndMain; LPCTSTR lpszClass=TEXT("InfoDlg"); int x; int y; TCHAR str[128]; 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)(COLOR_WINDOW+1); 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; } BOOL CALLBACK InfoDlgProc(HWND hDlg,UINT iMessage,WPARAM wParam,LPARAM lParam) { switch (iMessage) { case WM_INITDIALOG: SetDlgItemText(hDlg,IDC_STR,str); SetDlgItemInt(hDlg,IDC_X,x,FALSE); SetDlgItemInt(hDlg,IDC_Y,y,FALSE); return TRUE; case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: GetDlgItemText(hDlg,IDC_STR,str,128); x=GetDlgItemInt(hDlg,IDC_X,NULL,FALSE); y=GetDlgItemInt(hDlg,IDC_Y,NULL,FALSE); EndDialog(hDlg,IDOK); return TRUE; case IDCANCEL: EndDialog(hDlg,IDCANCEL); return TRUE; } break; } return FALSE; } LRESULT CALLBACK WndProc(HWND hWnd,UINT iMessage,WPARAM wParam,LPARAM lParam) { HDC hdc; PAINTSTRUCT ps; switch (iMessage) { case WM_CREATE: hWndMain=hWnd; x=100; y=100; lstrcpy(str, TEXT("String")); return 0; case WM_PAINT: hdc=BeginPaint(hWnd, &ps); TextOut(hdc,x,y,str,lstrlen(str)); EndPaint(hWnd, &ps); return 0; case WM_LBUTTONDOWN: if (DialogBox(g_hInst,MAKEINTRESOURCE(IDD_DIALOG1), hWnd,InfoDlgProc)==IDOK) InvalidateRect(hWnd,NULL,TRUE); return 0; case WM_DESTROY: PostQuitMessage(0); return 0; } return(DefWindowProc(hWnd,iMessage,wParam,lParam)); }
반응형
'Programing > API' 카테고리의 다른 글
API로 만들어본 소코반 게임. (0) | 2009.01.19 |
---|---|
API - TimerText2 (0) | 2009.01.19 |
API - 키보드 입력 (0) | 2009.01.19 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- 소니
- V3
- ffmpeg
- 유마일
- API 프로그래밍
- c#
- GAME
- Programming - C / C++
- TCP/IP
- Operation System
- 데몬
- 가상드라이브
- PSP
- Programing
- 구글
- WPF
- 스터디_발표자료
- 녹화
- 백신
- 하이퍼큐브
- 인코더
- Programming - C
- KAI
- 프로그래밍
- WL-54G
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함