Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Why can't i sent parameters to an IDC(I.D. Control)

  1. Feb 13, 2008 #1
    Why can't i send parameters to an IDC(I.D. Control)

    I'm programming a MFC project in C++ using Visual Studio. I'm trying to send 2 parameters through an IDC, so the values of these variables can past through other methods, but i keep getting an error message:error C2440: 'static_cast' : cannot convert from 'void (__thiscall CMFC_testDlg::* )(int &,int &)' to 'AFX_PMSG'
    So I took the "afx_msg" off of the class function in my header file, but it still doesn't work. It keeps referring back to this line of code in my Message Map: "ON_BN_CLICKED(IDC_Multiply, OnBnClickedMultiply)" What could I do to pass parameters to a Control, or is it just not possible? Let me know if you need anymore info to help me out. Thankx In Advance!!!
    Last edited: Feb 13, 2008
  2. jcsd
  3. Feb 13, 2008 #2


    User Avatar
    Science Advisor
    Homework Helper

    You can't have any arguements to the OnBnClicked function it must be "void OnBnClicked()"

    If you have a function DoBlah(int a,int b) that must be called when clicked you have to do something like

    void OnBnClicked()

    Where m_a, m_b are member variables set somewhere else
  4. Feb 13, 2008 #3
    Ok! I think I know what you mean. I tried that before, but I think I put in the wrong function call. I'll try it again your way. I would have move some things around to get the right results, though. I'll keep you posted. Thanks for your help.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?

Similar Discussions: Why can't i sent parameters to an IDC(I.D. Control)