Files
jiu/client/windows/runner/main.cpp
T
wangjia 20e7d07be3 feat(client): 关于我们内容改用配置文件 + 窗口标题改岩美酒库
- 新增 assets/config/app_info.json(服务商/网站/邮箱真实值),启动时
  AppInfo.load() 读取,不硬编码、不走环境变量
- 关于我们/续费/反馈处的服务商、网站、邮箱统一读配置
- Windows 窗口标题 jiu_client -> 岩美酒库(u8 + UTF-8→UTF-16 防乱码)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-05 01:08:45 +08:00

55 lines
1.7 KiB
C++

#include <flutter/dart_project.h>
#include <flutter/flutter_view_controller.h>
#include <windows.h>
#include <string>
#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);
// 窗口标题:用 u8 字面量 + UTF-8→UTF-16 转换,避免源码编码导致中文乱码。
const std::string title_utf8 = u8"岩美酒库";
int title_len = ::MultiByteToWideChar(CP_UTF8, 0, title_utf8.c_str(), -1,
nullptr, 0);
std::wstring window_title(title_len > 0 ? title_len - 1 : 0, L'\0');
if (title_len > 0) {
::MultiByteToWideChar(CP_UTF8, 0, title_utf8.c_str(), -1, &window_title[0],
title_len);
}
if (!window.Create(window_title, origin, size)) {
return EXIT_FAILURE;
}
window.SetQuitOnClose(true);
::MSG msg;
while (::GetMessage(&msg, nullptr, 0, 0)) {
::TranslateMessage(&msg);
::DispatchMessage(&msg);
}
::CoUninitialize();
return EXIT_SUCCESS;
}