windows平台代码修正

This commit is contained in:
2026-09-06 00:01:49 +08:00
parent 41151b7f8b
commit 005a3e7733
6 changed files with 80 additions and 32 deletions
+11 -3
View File
@@ -77,7 +77,8 @@ void save_path(HWND window) {
LRESULT CALLBACK window_proc(HWND window, UINT message, WPARAM wparam, LPARAM lparam) {
(void)lparam;
switch (message) {
try {
switch (message) {
case WM_CREATE: {
HFONT font = static_cast<HFONT>(GetStockObject(DEFAULT_GUI_FONT));
HWND title = CreateWindowW(L"STATIC", L"Spine粒子连接器", WS_CHILD | WS_VISIBLE, 24, 20, 540, 34, window, nullptr, nullptr, nullptr);
@@ -133,8 +134,11 @@ LRESULT CALLBACK window_proc(HWND window, UINT message, WPARAM wparam, LPARAM lp
break;
case WM_CLOSE: DestroyWindow(window); return 0;
case WM_DESTROY: service.stop(); PostQuitMessage(0); return 0;
}
return DefWindowProcW(window, message, wparam, lparam);
} catch (...) {
return DefWindowProcW(window, message, wparam, lparam);
}
return DefWindowProcW(window, message, wparam, lparam);
}
} // namespace
@@ -142,7 +146,11 @@ LRESULT CALLBACK window_proc(HWND window, UINT message, WPARAM wparam, LPARAM lp
int WINAPI wWinMain(HINSTANCE instance, HINSTANCE previous, PWSTR command_line, int show) {
(void)previous;
(void)command_line;
service.start(startup_error);
try {
service.start(startup_error);
} catch (...) {
startup_error = "连接器启动失败";
}
const wchar_t* class_name = L"SpineParticleConnectorWindow";
WNDCLASSW window_class{};
window_class.lpfnWndProc = window_proc;