0
votes

I'm developing an MFC application dedicated to Windows 7 GUI on visual studio 2013.
What I've done so far is I've added Main Item and Button into Application Button by getting some help from http://msdn.microsoft.com/en-us/library/ee354414.aspx as you can see in below image

My Application Demo.

Now, I want to know that how can I add Event Handler into it.

1

1 Answers

0
votes

Sorry, I'm giving answer of my own question.

I've done this by adding few line of code show below.

  • In MainFrm.h I've declare two public method
    afx_msg void OnMainItemKasim();
    afx_msg void OnButtonKasim();
    

  • In MainFrm.cpp. Define empty stub of both method
    void CMainFrame::OnMainItemKasim()
    {
        // TODO: Add your command handler code here
    }
    
    
    void CMainFrame::OnButtonKasim()
    {
        // TODO: Add your command handler code here
    }
    

  • finally, write following lines in BEGIN_MESSAGE_MAP
    ON_COMMAND(ID_FILE_KASIM, &CMainFrame::OnMainItemKasim)
    ON_COMMAND(ID_APP_KASIM, &CMainFrame::OnButtonKasim)
    

    where, ID_FILE_KASIM is Main Item below Save As & ID_APP_KASIM is button next to Exit button




  • Application Look