본문 바로가기

Windows/Windows API

16 픽셀 단위로 이동

LRESULT CALLBACK WndProc(HWND hWnd,UINT iMessage,WPARAM wParam,LPARAM lParam)
{
    HDC hdc;
    PAINTSTRUCT ps;
    char str[]="16픽셀 단위로만 움직입니다.";
    switch(iMessage) {
    case WM_WINDOWPOSCHANGING:
        ((LPWINDOWPOS)lParam)->x &= 0xfff0;
        ((LPWINDOWPOS)lParam)->y &= 0xfff0;
        ((LPWINDOWPOS)lParam)->cx &= 0xfff0;
        ((LPWINDOWPOS)lParam)->cy &= 0xfff0;
        return 0;
    case WM_PAINT:
        hdc=BeginPaint(hWnd, &ps);
        TextOut(hdc,100,100,str,strlen(str));
        EndPaint(hWnd, &ps);
        return 0;
    case WM_DESTROY:
        PostQuitMessage(0);
        return 0;
    }
    return(DefWindowProc(hWnd,iMessage,wParam,lParam));
}

'Windows > Windows API' 카테고리의 다른 글

최상위 윈도우  (0) 2013.10.01
팝업 윈도우  (0) 2013.10.01
화면 가장자리에 밀착  (0) 2013.10.01
기본 컨트롤  (0) 2013.10.01
원도우 이동,페이드  (0) 2013.10.01