Registering Windows Classes Win32

2019-08-21 04:31发布

问题:

what's the best practise for registering window classes for a win32 program?

Do you register every class in the WinMain function or as they're required?

回答1:

I used to do them as they're required, no need doing it before they're needed.



回答2:

No Need of registering if you using MFC because this will be doing in the backgrounds.. but if using win32 you need to register a windows class in WNDCLASS structure if you want to uise a windproc for your custom message handling see the MSDN link

http://msdn.microsoft.com/en-us/library/windows/desktop/ms633586(v=vs.85).aspx

even if you dont give a registerclass the system will be having a class that is registered with the window.

see the sample