bitsdojo_window
bitsdojo_window copied to clipboard
bitsdojo_window_windows works on Windows 10 or Greater only
GetDpiForWindow and GetSystemMetricsForDpi minimum supported client is Windows 10, version 1607.
Will this plugin support Windows 7 ?
This is a known issue and a fix is planned. Didn't have any time to do it recently but it is on my to-do list.
Please, these should be a priority fix. This is a great plugin but this makes it practically unusable if it will not work on a lot of PCs. Even if some functionalities don't work on older windows versions, at least it should not be a crashing error.
I had made this plugin working on Windows 7, Windows Server 2008/2012/2016/2019 , and Windows 10.
GetSystemMetricsForDpireplaced withGetSystemMetrics, and then multi with scale factor.GetDpiForWindowreplaced withFlutterDesktopGetDpiForHWNDwhich come from#include <flutter_windows.h>.DwmExtendFrameIntoClientAreacan not work on Windows Server, so I change theextendIntoClientAreamethod into this:
void extendIntoClientArea(HWND hwnd)
{
if(IsWindowsServer() && has_custom_frame == TRUE) {
SetMenu(hwnd, NULL);
LONG lStyle = GetWindowLong(hwnd, GWL_STYLE);
lStyle &= ~(WS_CAPTION | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_SYSMENU | WS_DLGFRAME);
SetWindowLong(hwnd, GWL_STYLE, lStyle);
LONG flags = SWP_FRAMECHANGED;
SetWindowPos(hwnd, NULL, 0, 0, 0, 0, flags);
} else {
MARGINS margins = { 0, 0, 1, 0 };
DwmExtendFrameIntoClientArea(hwnd, &margins);
}
}
IsWindowsServer() is come from #include <VersionHelpers.h>
5. bitsdojo_window_windows/lib/src/window.dart has a GetDpiForWindow FFI invoke, it's hard to find something to replace it, so just using 96.
Having the same issue, when will this get fix?
me too
Coming in the next update.
I've just submitted a PR #100 which resolves this. I confess I did the work before checking whether it was already under development. Feel free to take that patch or wait for the official one from @bitsdojo.
Mark this issue! Old windows 7 is needed because my company uses it.
For Windows 7, use @abutcher-gh solution above, the PR #100. I've tested in on Windows 7 and it works fine. If you clone this repo to local, don't forget to update all pubspec.yaml dependencies to local path also (project, platform interface, and the windows specific).
I've just submitted a PR #100 which resolves this. I confess I did the work before checking whether it was already under development. Feel free to take that patch or wait for the official one from @bitsdojo.
Thanks for your contribution,. It truly solved my problem but only on flutter of 2.0.4. When I update my flutter to 2.10.1, It doesn't work any more. Have you updated your fltter version? And does it work?
I had made this plugin working on Windows 7, Windows Server 2008/2012/2016/2019 , and Windows 10.
GetSystemMetricsForDpireplaced withGetSystemMetrics, and then multi with scale factor.GetDpiForWindowreplaced withFlutterDesktopGetDpiForHWNDwhich come from#include <flutter_windows.h>.DwmExtendFrameIntoClientAreacan not work on Windows Server, so I change theextendIntoClientAreamethod into this:void extendIntoClientArea(HWND hwnd) { if(IsWindowsServer() && has_custom_frame == TRUE) { SetMenu(hwnd, NULL); LONG lStyle = GetWindowLong(hwnd, GWL_STYLE); lStyle &= ~(WS_CAPTION | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_SYSMENU | WS_DLGFRAME); SetWindowLong(hwnd, GWL_STYLE, lStyle); LONG flags = SWP_FRAMECHANGED; SetWindowPos(hwnd, NULL, 0, 0, 0, 0, flags); } else { MARGINS margins = { 0, 0, 1, 0 }; DwmExtendFrameIntoClientArea(hwnd, &margins); } }
IsWindowsServer()is come from#include <VersionHelpers.h>5.bitsdojo_window_windows/lib/src/window.darthas aGetDpiForWindowFFI invoke, it's hard to find something to replace it, so just using 96.
After the form is minimized,to restore, the form background is black!