Fix Windows platform compilation errors - Unicode API calls and string encoding #12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes critical compilation errors preventing the Windows build from succeeding. The errors were primarily caused by mixing ANSI (narrow) and Unicode (wide) string types when calling Windows APIs.
Root Cause
The Windows platform implementation was inconsistently using ANSI versions of Windows APIs (like
LoadLibrary,CreateWindow,GetWindowText) while passing wide string literals and Unicode string types. This created compilation errors due to type mismatches betweenLPCSTRandconst wchar_t*.Key Changes
1. Consistent Unicode API Usage
Converted all Windows API calls to use Unicode (W) versions:
LoadLibrary→LoadLibraryWCreateWindow→CreateWindowWRegisterClass→RegisterClassWGetWindowText→GetWindowTextWSetWindowText→SetWindowTextWLoadImage→LoadImageWFindWindow→FindWindowWShell_NotifyIcon→Shell_NotifyIconW2. Structure Type Corrections
Updated Windows structures to use Unicode variants:
MENUITEMINFO→MENUITEMINFOWNOTIFYICONDATA→NOTIFYICONDATAWWNDCLASS→WNDCLASSW3. String Conversion Fixes
Fixed string type mismatches in
display_manager_windows.cppwhereCHARarrays were incorrectly being converted tostd::wstring. Now correctly converts tostd::stringfor narrow character device names.4. Missing Constants and Access Issues
SM_SCREENREADERconstant definition for older Windows SDK versionsKeyboardMonitor::Implprivate class access by adding friend declarationwindow_windows.cpp5. Platform-Specific Compatibility
_strdupinstead of deprecatedstrdupon Windows to eliminate warningswcscpy_sandwcsncpy_sImpact
These changes resolve all Windows compilation errors identified in the failed GitHub Actions build, enabling successful compilation on Windows platforms while maintaining compatibility with the existing codebase structure.
The fixes ensure consistent Unicode support throughout the Windows platform implementation, which is the recommended approach for modern Windows development and provides better internationalization support.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.