Private Declare Function CmppSend(ByVal m_hWnd As Long ,ByVal host(29)As Byte ,ByVal iport As Long,submit As Cmpp_Submit) As Long

解决方案 »

  1.   

    Private Type Submit_PART
        Pk_total             As Byte
        Pk_number            As Byte
        Registered_Delivery  As Byte  '该条信息是否要求应答
        Msg_level            As Byte
        Service_id(9)        As Byte
        Fee_UserType         As Byte
        Fee_terminal_id(20)  As Byte  'new added by lxj
        TP_pid               As Byte  'new added On Jun 15
        TP_udhi              As Byte  'new added
        Msg_Fmt              As Byte
        Msg_src(5)           As Byte
        FeeType(1)           As Byte
        FeeCode(5)           As Byte
        Valid_Time(16)       As Byte
        At_Time(16)          As Byte
        Src_terminal_id(20)  As Byte
        DestUsr_tl           As Byte
    End TypePrivate Type Message_Head
        Total_Length   As Long
        Command_ID     As Long
        Sequence_ID    As Long
    End TypePrivate Type Cmpp_Submit
        Message_Head As Message_Head
        Msg_id(7)    As Byte
        S_part       As Submit_PART
        Dest_phone   As DEST_t '该结构缺少声明
        Msg_Length   As Byte
        Msg_Cont     As Msg_C'该结构缺少声明
        Reserve(7)   As Byte
    End Type '这个是发送数据的消息体结构
    Private Declare Function CmppSend Lib "DllFile" (ByVal hWnd As Long, ByVal Host As String, ByVal Port As Long, Submit As Cmpp_Submit) As Long
      

  2.   


    typedef union{
    char Dest_terminal_id[21];
    char *dest;
    }DEST_t;typedef union{
    char Msg_Content[140];
    struct packet{
    int length;
    char *pkt;
    }Content;
    }Msg_C;忘了上面还有两个联合的类型,参数部分怎么声明?
      

  3.   

    Private Type Content
        Length As Long
        pkt    As Long
    End TypePrivate Type Cmpp_Submit
        Message_Head As Message_Head
        Msg_id(7)    As Byte
        S_part       As Submit_PART
        Dest_phone   As Long
        Msg_Length   As Byte
        Msg_Cont     As Content
        Reserve(7)   As Byte
    End Type '这个是发送数据的消息体结构Private Type PtrToStr
      Str As String
    End TypePrivate Declare Function CmppSend Lib "DllFile" (ByVal hWnd As Long, ByVal Host As String, ByVal Port As Long, Submit As Cmpp_Submit) As LongPrivate Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)'取Dest_phone
    Dim sBuf As PtrToStr,Submit As Cmpp_Submit
    If Submit.Dest_phone<>0 Then CopyMemory ByVal sBuf, ByVal Submit.Dest_phone, LenB(sBuf)
    Debug.Print sBuf.Str
    '取Msg_Cont
    Dim sBuf As PtrToStr,Submit As Cmpp_Submit
    If Submit.Msg_Cont.pkt<>0 Then CopyMemory ByVal sBuf, ByVal Submit.Msg_Cont.pkt, LenB(sBuf)
    Debug.Print sBuf.Str