As said in #24, I'm writing plugins using winio, so there may be multiple instances of winio in the same process. However, this will cause panic because they all register the same class name:
|
fn register() { |
|
unsafe { |
|
set_preferred_app_mode(PreferredAppMode::AllowDark); |
|
} |
|
let cls = WNDCLASSEXW { |
|
cbSize: std::mem::size_of::<WNDCLASSEXW>() as _, |
|
style: 0, |
|
lpfnWndProc: Some(window_proc), |
|
cbClsExtra: 0, |
|
cbWndExtra: 0, |
|
hInstance: unsafe { GetModuleHandleW(null()) }, |
|
hIcon: null_mut(), |
|
hCursor: unsafe { LoadCursorW(null_mut(), IDC_ARROW) }, |
|
hbrBackground: unsafe { GetStockObject(WHITE_BRUSH) }, |
|
lpszMenuName: null(), |
|
lpszClassName: WINDOW_CLASS_NAME, |
|
hIconSm: null_mut(), |
|
}; |
|
syscall!(BOOL, unsafe { RegisterClassExW(&cls) }).unwrap(); |
|
} |
A panic occurred panic.payload="called `Result::unwrap()` on an `Err` value: Os { code: 1410, kind: Uncategorized, message: \"Class already exists.\" }" panic.location="C:\\Users\\Chaoses\\.cargo\\git\\checkouts\\winio-267028aeb854993e\\ca97049\\winio-ui-win32\\src\\ui\\window.rs:344:55"
How about using the new added app name or something else to avoid conflicts?
As said in #24, I'm writing plugins using winio, so there may be multiple instances of winio in the same process. However, this will cause panic because they all register the same class name:
winio/winio-ui-win32/src/ui/window.rs
Lines 326 to 345 in ca97049
How about using the new added app name or something else to avoid conflicts?