自己写当然可以,但这不是你应该完成的事.看你那些原型的声明,自己转换为VB的声明应该没啥问题的.比如(1). BOOL _stdcall DSStartService(u16t uiListenPort);这个.就应该是这样的:Private Declare Function DSStartService Lib "gprsdll.dll" ( _ 
 ByVal uiListenPort As Integer)As Boolean

解决方案 »

  1.   


    '==============================================================================
    ' Constant defining ( 常数定义 )
    '==============================================================================
    Private Const MAX_RECEIVE_BUF = 1450Private Const DATA_TYPE_USERDATA = 1
    Private Const DATA_TYPE_CTLRESP = 2
    Private Const DATA_TYPE_JPEGDATA = 3
    Private Const DATA_TYPE_GPSDATA = 4Private Const CMD_SET_STRAIGHT = 1
    Private Const CMD_GET_STRAIGHT = 2
    Private Const CMD_SET_TIMESYNC = 3
    Private Const CMD_GET_TIMESYNC = 4
    Private Const CMD_SET_IFCAMERA = 5
    Private Const CMD_GET_IFCAMERA = 6Private Const MAX_JPEG_SIZE = 131072    '256 * 512'==============================================================================
    ' Data type defining ( 数据类型定义 )
    '==============================================================================
    Private Type ModemInfoStruct
        m_modemId As Long
        m_phoneno(11) As Byte
        m_dynip(3) As Byte
        m_conn_time As Currency
        m_refresh_time As Currency
        m_signal As Byte
    End TypePrivate Type ModemDataStruct
        m_modemId As Long
        m_recv_time As Currency
        m_data_buf(MAX_RECEIVE_BUF) As Byte
        m_data_len As Integer
        m_data_type As Byte
        m_jpegId As Long
    End Type'==============================================================================
    ' API function declare ( API函数声明 )
    '==============================================================================
    ' DSC API function declare
    Private Declare Function DSStartService Lib "gprsdll.dll" ( _
                                            ByVal uiListenPort As Integer) As Boolean
    Private Declare Function DSStopService Lib "gprsdll.dll" () As Boolean
    Private Declare Function DSGetNextData Lib "gprsdll.dll" ( _
                                            pDataStruct As Any, _
                                            ByVal waitseconds As Integer) As Boolean
    Private Declare Function DSSendData Lib "gprsdll.dll" ( _
                                            ByVal modemId As Long, _
                                            ByVal mlen As Integer, _
                                            buf As Any) As Boolean
    Private Declare Function DSGetModemCount Lib "gprsdll.dll" () As Long
    Private Declare Function DSGetModemByPosition Lib "gprsdll.dll" ( _
                                            ByVal pos As Long, _
                                            pModemInfo As Any) As Boolean
    Private Declare Function DSSendControl Lib "gprsdll.dll" ( _
                                            ByVal modemId As Long, _
                                            ByVal mlen As Integer, _
                                            buf As Any) As Boolean
    Private Declare Sub DSGetLastError Lib "gprsdll.dll" ( _
                                            str As Any, _
                                            ByVal nMaxBufSize As Long)
    Private Declare Sub DSGetVersion Lib "gprsdll.dll" ( _
                                            strVerBuf As Any, _
                                            ByVal iVerBufSize As Long)
    Private Declare Function DSIoCtrl Lib "gprsdll.dll" ( _
                                            ByVal u32Argu As Long, _
                                            ptrVal As Any, _
                                            ByVal sizeOfVal As Long) As Boolean
    Private Declare Function DSGetJpegById Lib "gprsdll.dll" ( _
                                            ByVal u32JpegId As Long, _
                                            ptrVal As Any, _
                                            ByVal sizeOfVal As Long) As Boolean
    ' Win32 API function declare
    Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" ( _
                                            Destination As Any, _
                                            Source As Any, _
                                            ByVal Length As Long)'==============================================================================
    ' 自定义函数及处理过程
    '==============================================================================
    '********************************************************************************
    '**   函 数 名 :   VBTypeToVCType_MIS
    '**   输    入 :   mVBType(ModemInfoStruct)   - 要通过Sock发送的任何类型数据内容
    '**   返    回 :   (Byte())                   - 拼合后的 ModemInfoStruct 类型字节流
    '**   功能描述 :   将 ModemInfoStruct 类型的数据转换到符合 VC 结构的字节流并返回
    '**   创建日期 :   2010-09-27
    '**   修 改 人 :
    '**   修改日期 :
    '**   版    本 :   Version 1.0.0
    '********************************************************************************
    Private Function VBTypeToVCType_MIS(mVBType As ModemInfoStruct) As Byte()
        ReDim VBTypeToVCType_MIS(36)
        CopyMemory VBTypeToVCType_MIS(0), mVBType.m_modemId, 4
        CopyMemory VBTypeToVCType_MIS(4), mVBType.m_phoneno(0), 12
        CopyMemory VBTypeToVCType_MIS(16), mVBType.m_dynip(0), 4
        CopyMemory VBTypeToVCType_MIS(20), mVBType.m_conn_time, 8
        CopyMemory VBTypeToVCType_MIS(28), mVBType.m_refresh_time, 8
        CopyMemory VBTypeToVCType_MIS(36), mVBType.m_signal, 1
    End Function
    Private Function VBTypeToVCType_MDS(mVBType As ModemDataStruct) As Byte()
        '...你自己模仿上面的写过程把
    End FunctionPrivate Function VCTypeToVBType_MIS(ByteArray() As Byte) As ModemInfoStruct
        '...你自己模仿上面的写过程把
    End FunctionPrivate Function VCTypeToVBType_MDS(ByteArray() As Byte) As ModemDataStruct
        '...你自己模仿上面的写过程把
    End Function因为VB的结构体和 VC 的有些不同,特别是在结构体中类型变换还带数组的这种结构体,空间分配
    和地址是不同的,VB的结构体中会在含数组部分多出10个字节来存储数组相关的信息,如数组边界、
    类型等相关信息,而VC的只是一个连续的内存地址,为了在逻辑上处理方便,通过 VBTypeToVCType_MIS
    处理过程将空间分配好或转换回来。
      

  2.   


    我们买的是蓝斯的LZ8713T,他们说只提供通信协议和测试软件,很郁闷……
      

  3.   

    DSGetNextData 返回true,但没有值  是怎么回事呢