Closed kiryasolod closed 1 year ago
Solved this problem myself by invoking my code in main function before tauri system is initialized:
fn main() {
let pc_id_result = license::get_pc_id();
let builder = tauri::Builder::default();
builder
.xmldos_setup(pc_id_result)
.on_menu_event(move |event| {
handle_main_menu_action(event.menu_item_id());
})
.xmldos_invoke_handler()
.run(tauri::generate_context!())
.expect("error while running tauri application")
}
My fn main code is not standard: most functions are encapsulated in other source files but it's still clear enough for other developers to understand how to use this library with tauri. I think, most people will invoke the library just once, before the app is initialized. I tried to run it in other thread but it does not work. So this is my working solution
Hello, dear author! I cannot get a drive serial number. I guess the problem is in wmi library. I got the following message:
thread 'main' panicked at 'called Result::unwrap() on an Err value: HResultError { hres: -2147417831 }', C:\Users\Garrus\.cargo\registry\src\github.com-1ecc6299db9ec823\machineid-rs-1.2.2\src\windows.rs:35:52
My tauri code is
Where
license::get_pc_id()
is the following function:It works if I don't use DriveSerial but I really need it. Please help