0
votes

I saw this documentation on MSDN.

I am trying to remove the standard frame of the window. I successfully extended the frame into client area, but the following snippet does not work. My window looks exactly the same as without it....

if (message == WM_CREATE)
{
    RECT rcClient;
    GetWindowRect(hWnd, &rcClient);

    // Inform the application of the frame change.
    SetWindowPos(hWnd, 
                 NULL, 
                 rcClient.left, rcClient.top,
                 (rcClient.right - rcClient.left), (rcClient.bottom - rcClient.top),
                 SWP_FRAMECHANGED);
}

Could anybody help me please?

2
Nothing in your code actually changes the frame, it just says to the positioning algorithm that it did and to recalculate some values. You need to change the actual window styles to change the style of the window.Deanna
I saw this snippet on MSDN...Victor
But have you actually done the rest of what the sample says? As the comment says, the code you pasted just tells the window that you changed the frame, but doesn't actually change anything.Deanna
I have done everything above that snippet on that page. Please, see the link; then you will see that there is just that code and below it, a screenshot with the changed frame.Victor
Please show your code that changes the window style too, as clearly something is missing.Deanna

2 Answers

1
votes

I think you can do it by passing WS_OVERLAPPED (not WS_OVERLAPPEDWINDOW) as the dwStyle parameter to CreateWindowEx when creating the window.

0
votes

It's really simple, just go to your window procedure, then the message WM_NCCALCSIZE and return 0 when WPARAM is TRUE

// Window Procedure
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
    switch (msg)
    {
    case WM_NCCALCSIZE:
        if (wparam == TRUE) return 0;
        break;
    }
    ...
}

As a clarification the code that you showed serves to force the previous code