bitsdojo / bitsdojo_window

A Flutter package that makes it easy to customize and work with your Flutter desktop app window.
http://www.youtube.com/watch?v=bee2AHQpGK4
MIT License
815 stars 229 forks source link

windows crash #177

Closed vmtest888 closed 11 months ago

vmtest888 commented 2 years ago

createParams->lpcs->lpszClass may be of type atom

    LRESULT CALLBACK monitorFlutterWindowsProc(
        _In_ int code,
        _In_ WPARAM wparam,
        _In_ LPARAM lparam)
    {
        if (code == HCBT_CREATEWND)
        {
            auto createParams = reinterpret_cast<CBT_CREATEWND*>(lparam);
            if (!createParams->lpcs->lpCreateParams)
            {
                return 0;
            }

            if(IS_INTRESOURCE(createParams->lpcs->lpszClass)){
                return 0;
            }

            if (wcscmp(createParams->lpcs->lpszClass, L"FLUTTER_RUNNER_WIN32_WINDOW") == 0)
            {
                flutter_window = (HWND)wparam;
                SetWindowSubclass(flutter_window, main_window_proc, 1, NULL);
            }
            else if (wcscmp(createParams->lpcs->lpszClass, L"FLUTTERVIEW") == 0)
            {
                flutter_child_window = (HWND)wparam;
                SetWindowSubclass(flutter_child_window, child_window_proc, 1, NULL);
            }
        }
        if ((flutter_window != nullptr) && (flutter_child_window != nullptr))
        {
            UnhookWindowsHookEx(flutterWindowMonitor);
        }
        return 0;
    }
wc2411888 commented 2 years ago

我也遇到了

vmtest888 commented 2 years ago
if(IS_INTRESOURCE(createParams->lpcs->lpszClass)){
    return 0;
}

加上这句就行了

bitsdojo commented 11 months ago

Please try updating to the latest bitsdojo_window version.