| 1 | #include <flutter/dart_project.h> |
| 2 | #include <flutter/flutter_view_controller.h> |
| 3 | #include <windows.h> |
| 4 | |
| 5 | #include "flutter_window.h" |
| 6 | #include "utils.h" |
| 7 | |
| 8 | int APIENTRY wWinMain |
| 9 | _In_ wchar_t *command_line |
| 10 | // Attach to console when present (e.g., 'flutter run') or create a |
| 11 | // new console when running with a debugger. |
| 12 | if (!::AttachConsole( |
| 13 | CreateAndAttachConsole(); |
| 14 | } |
| 15 | |
| 16 | // Initialize COM, so that it is available for use in the library and/or |
| 17 | // plugins. |
| 18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED |
| 19 | |
| 20 | flutter::DartProject |
| 21 | |
| 22 | std::vector< |
| 23 | GetCommandLineArguments(); |
| 24 | |
| 25 | project.set_dart_entrypoint_arguments(std |
| 26 | |
| 27 | FlutterWindow window( |
| 28 | Win32Window::Point |
| 29 | Win32Window::Size |
| 30 | if (!window.Create |
| 31 | return EXIT_FAILURE; |
| 32 | } |
| 33 | window.SetQuitOnClose(true) |
| 34 | |
| 35 | ::MSG msg |
| 36 | while (::GetMessage(& |
| 37 | ::TranslateMessage(&msg); |
| 38 | ::DispatchMessage(&msg); |
| 39 | } |
| 40 | |
| 41 | ::CoUninitialize(); |
| 42 | return EXIT_SUCCESS; |
| 43 | } |