CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 1999
    Posts
    14

    how to change the dialog'class name

    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

  2. #2
    Join Date
    Apr 1999
    Posts
    27,449

    Re: how to change the dialog'class name

    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



  3. #3
    Join Date
    Sep 1999
    Posts
    3

    Re: how to change the dialog'class name

    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



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured