函数原型
int WINAPI SgipSubmitSM(LPCTSTR sSPNumber, LPCTSTR sChargeNumber, unsigned char byUserCount, \
                        LPCTSTR sUserNumber, LPCTSTR sCorpID, LPCTSTR sServiceType, unsigned char byFeeType, \
                        LPCTSTR sFeeValue, LPCTSTR sGivenValue, unsigned char byAgentFlag, unsigned char byCauseMTFlag, \
                        unsigned char byPriority, LPCTSTR sExpireTime, LPCTSTR sScheduleTime, unsigned char byReportFlag, \
                        unsigned char byPID, unsigned char byUDHI, unsigned char byMsgCoding, unsigned char byMsgType, unsigned long ulMsgLen, \
                        LPCTSTR sMsgContent,char* sReserve,unsigned char &byResult);我写的函数
Public Declare Function SgipSubmitSM Lib "smeidll.dll" ( _
                ByVal sSPNumber As String, ByVal sChargeNumber As String, ByVal byUserCount As Byte, _
                ByVal sUserNumber As String, ByVal sCorpID As String, ByVal sServiceType As String, _
                ByVal byFeeType As Byte, ByVal sFeeValue As String, ByVal sGivenValue As String, ByVal byAgentFlag As Byte, _
                ByVal byCauseMTFlag As Byte, ByVal byPriority As Byte, ByVal sExpireTime As String, ByVal sScheduleTime As String, _
                ByVal byReportFlag As Byte, ByVal byPID As Byte, ByVal byUDHI As Byte, _
                ByVal byMsgCoding As Byte, ByVal byMsgType As Byte, ByVal ulMsgLen As Long, _
                ByVal sMsgContent As String, ByRef sReserve As String, ByRef byResult() As Byte) As Integer
急,在线等待,谢谢

解决方案 »

  1.   

    char* sReserve 转换为  Byval sReserve As String 或者 ByRef sReserve As Byte如果是后者的话调用的时候传递一个Byte数组的第一个元素。
      

  2.   

    不行......测试的时候检测数据包,总共发送了3次,第一次是我们要发送的内容,然后网关返回了一次数据,这边再发送一个6BYTE的数据过去....就没反应....最后再发了一次6BYTE的数据,程序就退出啦改了变量定义以后情况一样dim bReserve() as byte
    dim bResult() as byte
    eresult = SgipSubmitSM("85930", "13026504384", 1, _
                "13026504384", "32416", "CS", 2, "0", "0", 1, _
                0, 1, "", "", 0, 1, 1, _
                15, 0, 16, "免费手机短信", bReserve, bResult)
    这是调用函数的部分,会不会传递参数有问题?
      

  3.   

    从你的描述看,应该是双方通信的问题或者程序的问题而不是函数定义的问题。另外在调用中你传递了"",你确定是要传一个空字符串还是穿一个空指针?如果是后者的话需要使用vbNullString。另外就是中文的问题,你先不要在你的调用中采用中文字符串试试。
      

  4.   

    ....
    还是不行,情况一样,除了第一次发送数据包小了以外日期按照文档的规定写了"YY/MM/DD HH:MM:SS"
    麻烦啊!
    谢谢楼上的热心回答 ;)