#pragma once #include #include #define TRAY_ICON_ID 1001 #define WM_TRAYICON (WM_USER + 1) // 窗口类 class SDLWindow { public: SDLWindow(); ~SDLWindow(); int32_t Run(); protected: void CreateTrayIcon(); void QuitApplication(); LRESULT WindowProcedure(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); static LRESULT CALLBACK StaticWindowProcedure(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); static DWORD WINAPI SerialListenerThread(LPVOID lpParam); static void AudioCallback(void* userdata, Uint8* stream, int len); private: HWND hWnd; NOTIFYICONDATA trayIconData; SDL_AudioSpec audioSpec; SDL_AudioDeviceID audioDeviceID; SDL_atomic_t Quit; };