0

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?

Victor
  • 13,914
  • 19
  • 78
  • 147
  • 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 Jan 24 '13 at 08:51
  • I saw this snippet on MSDN... – Victor Jan 24 '13 at 11:28
  • 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 Jan 24 '13 at 12:33
  • 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 Jan 25 '13 at 08:42
  • Please show your code that changes the window style too, as clearly something is missing. – Deanna Jan 27 '13 at 20:35
  • @Victor - If you've not solved that problem and are still curious, you can see a more complete example in a question I answered earlier today, here: http://stackoverflow.com/questions/31093494/drawing-in-the-extended-frame-gives-strange-colors/31101981#31101981 – enhzflep Jun 28 '15 at 18:59

2 Answers2

1

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

user1610015
  • 6,561
  • 2
  • 15
  • 18
1

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

surreal Ceres
  • 35
  • 1
  • 5