Description
Building tauri-mcp on Windows fails with compilation errors in the Windows-specific code.
Environment
- OS: Windows
- Rust: Latest stable
- Version: v0.1.4 (crates.io) and v0.1.5 (GitHub main)
Error Output
error[E0432]: unresolved import `windows::Win32::UI::WindowsAndMessaging::GetWindowText`
--> src\tools\window.rs:22:62
|
22 | use windows::Win32::UI::WindowsAndMessaging::{GetWindowRect, GetWindowText, GetWindowTextLengthW};
| ^^^^^^^^^^^^^
| no `GetWindowText` in `Win32::UI::WindowsAndMessaging`
| help: a similar name exists in the module: `GetWindowTextA`
error[E0412]: cannot find type `HWND` in this scope
--> src\utils\platform.rs:37:54
|
37 | unsafe extern "system" fn enum_window_callback(hwnd: HWND, lparam: isize) -> i32 {
| ^^^^ not found in this scope
error[E0308]: mismatched types
--> src\utils\platform.rs:27:18
|
27 | Some(enum_window_callback),
| ---- ^^^^^^^^^^^^^^^^^^^^ expected fn pointer, found fn item
|
= note: expected fn pointer `unsafe extern "system" fn(HWND, LPARAM) -> BOOL`
found fn item `unsafe extern "system" fn({type error}, isize) -> i32 {enum_window_callback}`
error[E0277]: the trait bound `isize: IntoParam<LPARAM, CopyType>` is not satisfied
Root Cause
GetWindowText doesn't exist in windows crate v0.52.0 - should use GetWindowTextW (Unicode) or GetWindowTextA (ANSI)
HWND type needs to be imported from windows::Win32::Foundation::HWND in platform.rs
- Callback function signature and LPARAM parameter handling issues
Suggested Fix
Update the Windows API usage to match windows crate v0.52.0 API:
- Use
GetWindowTextW instead of GetWindowText
- Import
HWND properly in platform.rs
- Fix callback signature to use
LPARAM type
Workaround
Currently no workaround for direct cargo install on Windows. The DXT package with Node.js wrapper is recommended for Claude Desktop users.
Description
Building tauri-mcp on Windows fails with compilation errors in the Windows-specific code.
Environment
Error Output
Root Cause
GetWindowTextdoesn't exist in windows crate v0.52.0 - should useGetWindowTextW(Unicode) orGetWindowTextA(ANSI)HWNDtype needs to be imported fromwindows::Win32::Foundation::HWNDin platform.rsSuggested Fix
Update the Windows API usage to match windows crate v0.52.0 API:
GetWindowTextWinstead ofGetWindowTextHWNDproperly in platform.rsLPARAMtypeWorkaround
Currently no workaround for direct cargo install on Windows. The DXT package with Node.js wrapper is recommended for Claude Desktop users.