When I create a child window for the second time,
if (!::RegisterClass(&hwClass))
{
throw std::runtime_error("RegisterClass failed!");
}
It throws an exception that the class already exists. but the child window class was deleted when the child window was destroyed at:
WM_DESTROY:
{
delete this; //destroy child class
}
It works if I comment the expection error. does that mean I don't need to register a class again?
From the UnregisterClass
documentation, which states:
Before calling this function, an application must destroy all windows created with the specified class.
Indicates that destroying the windows doesn't unregister the class.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With