CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Jan 2009
    Posts
    69

    MFC class wizard

    Hi,
    I am following tutorial and trying to do following...Use ClassWizard to set up a message handler for WM_TIMER:
    I got the screen shot of what I need to do. I have vs 8 running.Only way i know how to access class wizard is if I click on control on my dialog and then right click to add variable or class but I never seen when I invoke class wizard anything like I have on this screen shot. How do I access this class wizard.
    Thanks
    Attached Images Attached Images

  2. #2
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,637

    Re: MFC class wizard

    Class Wizard is from VC6.

  3. #3
    Join Date
    Jan 2009
    Posts
    69

    Re: MFC class wizard

    How do I get this in vs 8

  4. #4
    Join Date
    Mar 2004
    Location
    KL, Malaysia
    Posts
    63

    Re: MFC class wizard

    Quote Originally Posted by joker1969 View Post
    How do I get this in vs 8
    Class Wizard Dialog is no longer available after VC6.

  5. #5
    Join Date
    Jan 2009
    Posts
    69

    Re: MFC class wizard

    I am trying to add handler for WM_TIMER that's why I needed this class wizard. I just tried to write OnTimer() method but it didn't work so obviously needs to be added by using class wizard.

  6. #6
    Join Date
    May 1999
    Location
    ALABAMA, USA
    Posts
    9,917

    Re: MFC class wizard

    Depending on how you define a method. For me OnTimer is not a method, it is a message handler (one of the elements of static function array). It is called by the framework to allow you to handle windows messages.

    In VS later than 6, in a class view select class you want to add a message handler and invoke properties.
    You will have several buttons at the top of property box
    Press button pointed by the arrow and select a message you want to handle.
    Attached Images Attached Images
    There are only 10 types of people in the world:
    Those who understand binary and those who do not.

  7. #7
    Join Date
    Mar 2004
    Location
    KL, Malaysia
    Posts
    63

    Re: MFC class wizard

    Quote Originally Posted by joker1969 View Post
    I am trying to add handler for WM_TIMER that's why I needed this class wizard. I just tried to write OnTimer() method but it didn't work so obviously needs to be added by using class wizard.
    No, you can still code it by hand without the class wizard.

    Add this to your header file:

    Code:
    afx_msg void OnTimer(UINT nIDEvent);
    Add this to your cpp file:

    Code:
    BEGIN_MESSAGE_MAP(CMyDlg, CDialog)
    	ON_WM_TIMER()
    END_MESSAGE_MAP()
    
    void CMyDlg::OnTimer(UINT nIDEvent)
    {
    
        CDialog::OnTimer(nIDEvent);
    }

  8. #8
    Join Date
    May 1999
    Location
    ALABAMA, USA
    Posts
    9,917

    Re: MFC class wizard

    Quote Originally Posted by ckweius View Post
    No, you can still code it by hand without the class wizard.
    Of course, you can. You can also write entire application without MFC or you can manually enter DDX calls. A question is WHY bother, if you have a tools to do it for you, so instead wasting time on reinventing a wheel you can spend time to write robust code.
    There are only 10 types of people in the world:
    Those who understand binary and those who do not.

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