Ignore the "Class already exists" error in multiple-window application

This commit is contained in:
Krzysztof Kondrak 2015-12-28 16:50:51 +01:00 committed by Krzysztof Kondrak
parent 6fd476783c
commit de47861fe3

View file

@ -249,9 +249,15 @@ impl Window {
}; };
if user32::RegisterClassW(&class) == 0 { if user32::RegisterClassW(&class) == 0 {
let err_code = kernel32::GetLastError() as u32;
// ignore the "Class already exists" error for multiple windows
if err_code != 1410
{
println!("Unable to register class, error {}", kernel32::GetLastError() as u32); println!("Unable to register class, error {}", kernel32::GetLastError() as u32);
return None; return None;
} }
}
let new_width = width * scale_factor as usize; let new_width = width * scale_factor as usize;
let new_height = height * scale_factor as usize; let new_height = height * scale_factor as usize;