google / flutter-desktop-embedding

Experimental plugins for Flutter for Desktop
Apache License 2.0
7.11k stars 608 forks source link

Hide window title bar #766

Closed CrazyMan-IK closed 4 years ago

CrazyMan-IK commented 4 years ago

Hello, I wanted to remove the title bar from the window and replace it with mine. But if I use SetWindowLong, then I lose the window resizing. I found out that you can use dwmapi.h, but it is not in flutter. How else can I remove the title bar without losing window resizing.

I am using this code now:

    HWND hWnd = GetActiveWindow();

    SetMenu(hWnd, NULL);
    LONG lStyle = GetWindowLong(hWnd, GWL_STYLE);
    // lStyle &= ~(WS_CAPTION | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_SYSMENU);
    // lStyle &= WS_DLGFRAME;
    lStyle &= ~(WS_CAPTION | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_SYSMENU | WS_DLGFRAME);
    SetWindowLong(hWnd, GWL_STYLE, lStyle);
    LONG flags = SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER;
    SetWindowPos(hWnd, NULL, 0, 0, 0, 0, flags);

    flutter::EncodableValue response(true);
    result->Success(&response);
stuartmorgan commented 4 years ago

I found out that you can use dwmapi.h, but it is not in flutter.

I'm not sure what this means. No Win32 headers are in Flutter; they are in the Windows SDK. The whole point of plugins is that they give access to the full OS API surface.

How else can I remove the title bar without losing window resizing.

If you have questions about Win32 in general, I would suggest a general resource like StackOverflow. This question doesn't appear to involve Flutter at all (other than that your app is a Flutter app, but how content is drawn in the window is irrelevant to what you are trying to do).

I'm not sure why this is filed as an issue in this repository. Are you requesting this functionality for the window_size plugin? If so, it seems like something that would be much better done when the window is created rather than after the fact in a plugin.

CrazyMan-IK commented 4 years ago

OK, Thanks for your answer