¿

WS_POPUP WS_THICKFRAME Ÿ ¥:2021-8-7 10:28:56 ȸ:506
ۼ : ҳⰡ
Ʈ : 438
: 2020-02-02 00:50:03
湮Ƚ : 54
42, 27
Ұ : ڱҰ
ۼ

Ŀ 츦 Ӽ ôµ ̻ .

׷ ˾ β 輱 ʿ ٰ ǥõȴ.

۾ ũⰡ 輱 پ ִ. 

׷ Ҵ. 

#include

LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
HINSTANCE g_hInst;
HWND hWndMain;
LPCTSTR lpszClass = TEXT("PopupWnd");

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(LTGRAY_BRUSH);
    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_POPUP | WS_VISIBLE,
        1000, 500, 100, 100,
        NULL, (HMENU)NULL, hInstance, NULL);
    CreateWindow(lpszClass, lpszClass, WS_POPUP | WS_BORDER | WS_VISIBLE,
        1110, 500, 100, 100,
        NULL, (HMENU)NULL, hInstance, NULL);
    CreateWindow(lpszClass, lpszClass, WS_POPUP | WS_THICKFRAME | WS_VISIBLE,
        1220, 500, 100, 100,
        NULL, (HMENU)NULL, hInstance, NULL);
    ShowWindow(hWnd, nCmdShow);
    hWndMain = hWnd;

    while (GetMessage(&Message, NULL, 0, 0)) {
        TranslateMessage(&Message);
        DispatchMessage(&Message);
    }
    return Message.wParam;
}

LRESULT CALLBACK WndProc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam)
{
    HDC hdc;
    PAINTSTRUCT ps;
    UINT nHit;
    TCHAR Mes[128];

    switch (iMessage) {
    case WM_PAINT:
        hdc = BeginPaint(hWnd, &ps);
        SetBkMode(hdc, TRANSPARENT);
        RECT wrt;
        GetWindowRect(hWnd, &wrt);
        wsprintf(Mes, TEXT("W:%d,%d"), wrt.right - wrt.left, wrt.bottom - wrt.top);
        TextOut(hdc, 10, 10, Mes, lstrlen(Mes));
        RECT crt;
        GetClientRect(hWnd, &crt);
        wsprintf(Mes, TEXT("C:%d,%d"), crt.right, crt.bottom);
        TextOut(hdc, 10, 30, Mes, lstrlen(Mes));
        EndPaint(hWnd, &ps);
        return 0;
    case WM_NCHITTEST:
        nHit = DefWindowProc(hWnd, iMessage, wParam, lParam);
        if (nHit == HTCLIENT)
            nHit = HTCAPTION;
        return nHit;
    case WM_DESTROY:
        PostQuitMessage(0);
        return 0;
    }
    return(DefWindowProc(hWnd, iMessage, wParam, lParam));
}

˾ 3 Ÿ ٲ 100 * 100 ũ ߴµ . 



ũ 翬 100 * 100̰ 輱 ۾ Ȱ. 

WS_BORDER Ÿ ָ ¿ 1ȼ 輱 Ͽ ۾ 2ȼ پ .

׷ WS_THICKFRAME ָ 14ȼ پ Ӹ ƴ϶ ŸƲ ʿ ٰ .

ٱʿ ׸ڸ ۾ ġ ҵǰ ʿ ٱ ׾. 

̷ ʾҴٴ ̴.

̳ ׸ ũ⸦ ȮϷ WS_THICKFRAME Ÿ ƾ Ѵ.

WS_POPUP 鼭 ũ 浵 Ϸ ᱹ ڵϴ ۿ . 

ϰ WS_POPUP Ÿϸ ְ 100 * 100 ũ 츦 Ѵ. 

    hWnd = CreateWindow(lpszClass, lpszClass, WS_POPUP | WS_VISIBLE,
        1000, 500, 100, 100,
        NULL, (HMENU)NULL, hInstance, NULL);
    ShowWindow(hWnd, nCmdShow);

.....

LRESULT CALLBACK WndProc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam)
{
    HDC hdc;
    PAINTSTRUCT ps;
    UINT nHit;
    TCHAR Mes[128];
    const int borderThick = 2;
    HPEN gray, darkgray, oldPen;

    switch (iMessage) {
    case WM_PAINT:
        hdc = BeginPaint(hWnd, &ps);
        SetBkMode(hdc, TRANSPARENT);
        RECT wrt;
        GetWindowRect(hWnd, &wrt);
        RECT crt;
        GetClientRect(hWnd, &crt);
        // 輱 Ը ׸.
        // Rectangle ׸ ϴ.
        gray = CreatePen(PS_SOLID, 1, RGB(0xf0, 0xf0, 0xf0));
        darkgray = CreatePen(PS_SOLID, 1, RGB(0xa0, 0xa0, 0xa0));
        oldPen = (HPEN)SelectObject(hdc, gray);
        MoveToEx(hdc, 0, 0, NULL); LineTo(hdc, crt.right, 0);
        MoveToEx(hdc, 0, 0, NULL); LineTo(hdc, 0, crt.bottom);
        MoveToEx(hdc, crt.right - 2, 0, NULL); LineTo(hdc, crt.right - 2, crt.bottom - 1);
        MoveToEx(hdc, 1, crt.bottom - 2, NULL); LineTo(hdc, crt.right - 2, crt.bottom - 2);
        SelectObject(hdc, darkgray);
        MoveToEx(hdc, 1, 1, NULL); LineTo(hdc, crt.right - 2, 1);
        MoveToEx(hdc, 1, 1, NULL); LineTo(hdc, 1, crt.bottom - 2);
        MoveToEx(hdc, crt.right - 1, 0, NULL); LineTo(hdc, crt.right - 1, crt.bottom - 1);
        MoveToEx(hdc, 0, crt.bottom - 1, NULL); LineTo(hdc, crt.right - 1, crt.bottom - 1);
        SelectObject(hdc, oldPen);
        DeleteObject(gray);
        DeleteObject(darkgray);

        wsprintf(Mes, TEXT("W:%d,%d"), wrt.right - wrt.left, wrt.bottom - wrt.top);
        TextOut(hdc, 10, 10, Mes, lstrlen(Mes));
        wsprintf(Mes, TEXT("C:%d,%d"), crt.right, crt.bottom);
        TextOut(hdc, 10, 30, Mes, lstrlen(Mes));
        EndPaint(hWnd, &ps);
        return 0;
    case WM_NCHITTEST:
        nHit = DefWindowProc(hWnd, iMessage, wParam, lParam);
        if (nHit == HTCLIENT) {
            RECT crt;
            POINT mpt;
            GetClientRect(hWnd, &crt);
            mpt.x = LOWORD(lParam);
            mpt.y = HIWORD(lParam);
            ScreenToClient(hWnd, &mpt);

            // ¿캯 Ŀ ũ⸦ Ѵ.
            if (mpt.x < borderThick)
                return HTLEFT;
            if (mpt.x > crt.right - 1 - borderThick)
                return HTRIGHT;
            if (mpt.y < borderThick)
                return HTTOP;
            if (mpt.y > crt.bottom - 1 - borderThick)
                return HTBOTTOM;
        }
        // 츦 ̵Ѵ.
        nHit = HTCAPTION;
        return nHit;
    case WM_DESTROY:
        PostQuitMessage(0);
        return 0;
    }
    return(DefWindowProc(hWnd, iMessage, wParam, lParam));
}

WM_PAINT 輱 ׸. ణ , Ʒ ణ Ӱ Ͽ ü ־.

̰ Rectangleε ׸ ġ κ ־ ǥߴ. 

ES_EX_CLIENTEDGE Ȯ ŸϷ ȿ ̰͵ ׸ ޶ ־

ʴ. ׳ ׸° ϴ. 

WM_NCHITTEST Ŀ ġ 輱 ǺϿ Ŀ ϸ ũ ϴ.

𼭸 κе ó ׷Ա ʾҴ. 

輱 ̿ κ 츦 ̵ϴ óߴ. 

Ĵ ϸ Ŀ 츦 ְ . 






 



õ ּ .
미카와 가게 파트너구함 관촉동출장만남 동춘동타이마사지 서부산유통지구역타이마사지 약수역번개만남 호근동마사지 오피 오줌 포동콜걸 만안구콜걸 부산진출장샵 콜걸샵 삼척시출장마사지 피부 퍼플스파티 가습기 엉덩이 골지단가라원피스

엄마아들 내일부터 제주여행 한옥마을 외식스타그램 남산타워 백일상대여추천 소통하자 스시 와인동호회 경산출장마사지 천호 입싸 함락카쿠 결혼식 하객 알바

Ϻ Ű ũ


αϼž ֽϴ.