Files
WT810787899 2dd286f64a build(windows): 可执行文件改为 YuChuan.exe,嵌入新图标,修正版本资源
- windows/CMakeLists.txt: BINARY_NAME rust_flutter_ui -> YuChuan
  (CMake 的 target 名不支持非 ASCII,写「雨传」会直接报
   Cannot specify compile definitions for target 雨传 which is not built,
   所以构建名用 ASCII,发布时由 package_release.ps1 改名为「雨传.exe」)
- windows/runner/CMakeLists.txt: 加 /utf-8 —— main.cpp 是无 BOM 的 UTF-8,
  不指定的话 MSVC 按系统代码页(GBK)读,中文字面量会变乱码
- windows/runner/main.cpp: 原生窗口标题 YuChuan -> 雨传 YuChuan
- windows/runner/Runner.rc: 版本资源补齐/修正
  FileDescription -> 雨传 YuChuan - 局域网聊天 / 传文件工具
  ProductName/InternalName/OriginalFilename -> 雨传
  LegalCopyright 去掉模板残留的 com.example
- scripts: 同步 exe 名;新增 package_release.ps1(便携版 zip + 安卓包)

说明:图标是编译期嵌进二进制的,改图标必须重新构建(本机无 rcedit/
ResourceHacker 之类可直接改 exe 资源的工具)。
2026-10-15 21:02:41 +08:00

44 lines
1.2 KiB
C++

#include <flutter/dart_project.h>
#include <flutter/flutter_view_controller.h>
#include <windows.h>
#include "flutter_window.h"
#include "utils.h"
int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
_In_ wchar_t *command_line, _In_ int show_command) {
// Attach to console when present (e.g., 'flutter run') or create a
// new console when running with a debugger.
if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) {
CreateAndAttachConsole();
}
// Initialize COM, so that it is available for use in the library and/or
// plugins.
::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
flutter::DartProject project(L"data");
std::vector<std::string> command_line_arguments =
GetCommandLineArguments();
project.set_dart_entrypoint_arguments(std::move(command_line_arguments));
FlutterWindow window(project);
Win32Window::Point origin(10, 10);
Win32Window::Size size(1280, 720);
if (!window.Create(L"雨传 YuChuan", origin, size)) {
return EXIT_FAILURE;
}
window.SetQuitOnClose(true);
::MSG msg;
while (::GetMessage(&msg, nullptr, 0, 0)) {
::TranslateMessage(&msg);
::DispatchMessage(&msg);
}
::CoUninitialize();
return EXIT_SUCCESS;
}