[API] Static

simpled 2013.06.23 15:55 조회 수 : 6165

/*

 

스태틱(static)은 다른 컨트롤에 비해 비교적 간단한 컨트롤이다.

입력은 없고 오로지 문자열을 보여주는 것이 기능의 전부이기 때문이다.

 

*/

 

LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)

{

        int wmId, wmEvent;

        PAINTSTRUCT ps;

        HDC hdc;

 

        switch (message)

        {

               case WM_CREATE:

                       CreateWindow(TEXT("static"), TEXT("Only TEXT"),

                              WS_CHILD | WS_VISIBLE,

                              0, 0, 100, 30, hWnd, (HMENU)0, hInst, NULL);

                       break;

               case WM_COMMAND:

                       wmId    = LOWORD(wParam);

                       wmEvent = HIWORD(wParam);

                       // 메뉴의선택영역을구문분석합니다.

                       switch (wmId)

                       {

                              case IDM_ABOUT:

                                      DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);

                                      break;

                              case IDM_EXIT:

                                      DestroyWindow(hWnd);

                                      break;

                              default:

                                      return DefWindowProc(hWnd, message, wParam, lParam);

                       }

                       break;

               case WM_PAINT:

                       hdc = BeginPaint(hWnd, &ps);

                       // TODO: 여기에그리기코드를추가합니다.

                       EndPaint(hWnd, &ps);

                       break;

               case WM_DESTROY:

                       PostQuitMessage(0);

                       break;

               default:

                       return DefWindowProc(hWnd, message, wParam, lParam);

        }

        return 0;

}