Click to See Complete Forum and Search --> : how to change the dialog'class name
qiyang
June 9th, 1999, 11:31 AM
As we know ,the default class name of Dialog box
is "Dialog",but I can not change its classname (the Dialog-based MFC programme) by changing the ''cs'' structure of PrecreateWindow function.Could you help me to solve this question?
Remember ! Your suggestion can make a difference!
Thank you!
qiyang
Paul McKenzie
June 9th, 1999, 05:20 PM
If PreCreateWindow is called, what you want to do must be done carefully. I don't know if you realize this, but changing the class name will not only change the name, but Windows will attempt to look for a predefined window class that has been registered using RegisterClass().
The steps required to do what you want *safely* are as follows:
1) Get the WNDCLASS structure for the window within the PreCreateWindow() function. The call to do this is GetClassInfoEx().
2) Change the class name within the returned WNDCLASS structure.
3) Register a new window class by calling RegisterClass() with the changed WNDCLASS structure.
4) You now have a dialog class that is not called "Dialog", but with your own name. Now it's your job to create windows that are of this new class.
5) Make sure that you call UnregisterClass() when the app is finished (unless you really want to do something special).
Is this what you wanted to do?
Regards,
Paul McKenzie
M D
October 20th, 1999, 10:09 AM
Thank you Paul but...
Ok I Have a wnd with the right WNDCLASS .
How can I use it as a Dialog (CDialog) with DDX/DDV ...
SubClassing ?
Making everything by myself (Dialog functionnalities)
Thank You
Michel
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.