注册 登录
编程论坛 VC++/MFC

高手请进,应该怎么解决这个问题,关于参数不匹配

huangbijun 发布于 2011-04-03 21:15, 651 次点击
GetDataPacket()是激光控件的一个函数(定义见附注).我每次编译都通不过,求高手讲解.

void CMyDlg::OnButton1()
{
    // TODO: Add your control notification handler code here
    m_MT2.SearchDevice();
    m_jindu=m_MT2.GetDeviceSearchProgress();
    m_shumu=m_MT2.GetTotalDeviceCnt();
    m_shuju=m_MT2.GetDataPacket(1,1);
}

运行提示错误:F:\激光++++++++++++++++++++++\激光\激光Dlg.cpp(184) : error C2664: 'GetDataPacket' : cannot convert parameter 1 from 'const int' to 'short *'
       Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
Error executing cl.exe.

附注:BSTR GetDataPacket(short* pDevIndex, short* pPacketTypeIndex)
Return the latest data packet in ASCII string format obtained from the specified device. Call
this function when you get NewDataPacket Event. The output parameter pPacketTypeIndex
is one of the following values to indicate the command type. The syntax of the return value is
described in each Get methods.

-1 TELEMETRY          0 DISPLAY_MODE           1 UPPER_LIMIT
2 LOWER_LIMIT         3 UNITS                  4 FILTER         
5 USER_CAL            6 CAL_SIGN               8 CONTRAST
9 INTENSITY           11 CUT_TIME              12 BAUD
13 ADDR               16 AUTO_ZERO             17 LASER
18 TELEM_DEST_ADDR    19 TELEM_TIMER           20 HEAD_MODEL

5 回复
#2
红色警戒2011-04-04 09:41
传short型指针,不能传变量值。
#3
twtrwr2011-04-04 15:23
BSTR GetDataPacket(short* pDevIndex, short* pPacketTypeIndex)

传short型指针
#4
ljt2011-04-04 22:17
查下msdn,什么都出来了
#5
dengjinbao2011-04-05 21:36
回复 4楼 ljt
给我个msdn咯 QQ360291203 谢谢
#6
huangbijun2011-04-05 22:51
自己解决,不过还是要谢谢各位!
1