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

In summary, the conversation discusses the issue of sending parameters to an IDC (I.D. Control) in a MFC project in C++ using Visual Studio. The individual is attempting to send two parameters through the IDC, but encounters an error message and difficulty passing the parameters to the control. The solution involves removing the "afx_msg" from the class function in the header file and using a member variable to set the parameters in the OnBnClicked function.
  • #1
sweetjones
44
0
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:
Technology news on Phys.org
  • #2
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()
{
DoBlah(m_a,m_b);
}

Where m_a, m_b are member variables set somewhere else
 
  • #3
mgb_phys said:
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()
{
DoBlah(m_a,m_b);
}

Where m_a, m_b are member variables set somewhere else

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.
 

Why can't I send parameters to an IDC (I.D. Control)?

1. How do I send parameters to an IDC? - In order to send parameters to an IDC, you need to use a data transmission method or protocol that is compatible with the IDC. This can include using a specific programming language, a specific hardware interface, or a specific software application. 2. What is an IDC? - An IDC (I.D. Control) is a type of electronic control device that is used to manage and monitor devices or systems. It is typically used in industrial or manufacturing settings to control and regulate processes. 3. Why do I need to send parameters to an IDC? - Sending parameters to an IDC allows you to customize the control settings and adjust the behavior of the controlled device or system. This is important for achieving optimal performance and ensuring the safety of the controlled process. 4. Can I send parameters to an IDC remotely? - Yes, it is possible to send parameters to an IDC remotely. This can be done through a remote connection or by using a remote communication protocol that is supported by the IDC. 5. What should I do if I am unable to send parameters to an IDC? - If you are having trouble sending parameters to an IDC, make sure that you are using the correct data transmission method, check for any connectivity issues, and verify that the IDC is properly configured to receive parameters. If the problem persists, consult the user manual or contact the manufacturer for further assistance.

Similar threads

  • Programming and Computer Science
Replies
2
Views
383
  • Programming and Computer Science
Replies
1
Views
273
  • Programming and Computer Science
Replies
5
Views
820
  • Engineering and Comp Sci Homework Help
Replies
1
Views
898
  • Programming and Computer Science
Replies
16
Views
3K
  • Programming and Computer Science
Replies
4
Views
4K
  • Programming and Computer Science
Replies
4
Views
2K
  • Programming and Computer Science
Replies
8
Views
1K
  • Electrical Engineering
Replies
15
Views
2K
Replies
40
Views
3K
Back
Top