将tx_buf声明成Any绘比较方便phase(4) As Byte表示有phase(0)~phase(4)五个Byte 应该是phase(0 to 3) As Byte Public Declare Function ose_com_send_msg Lib "mydll.dll" (ByVal chan_id As Integer, ByVal msg_len As Integer, ByRef tx_buf As Any, ByRef err_code As Long) As Integer Public Type BSC_COM_TR rece_ph As Byte tran_ph As Byte tran_da As Byte rece_att As Byte bit As Byte work As Byte tran_pow As Byte End TypePublic Type BSC_COM_TRU tru_tran_pow As Byte tru_tran_da As Byte work_array As Byte tr(0 to 7) As BSC_COM_TR End TypePublic Type BSC_COM_PH phase(0 to 3) As Byte att(0 to 3) As Byte End TypePublic Type BSC_COM_BSC lvps_key As Byte hvps_key As Byte k1 As Byte k2 As Byte k3 As Byte int_tr As Byte timer As Byte ph(0 to 3) As BSC_COM_PH tru(0 to 7) As BSC_COM_TRU End TypePublic Type MESSAGE_HEADER message_code_e As Integer message_length_uh As Integer time_tag_ul As Long message_number_uh As Integer message_channel_uc(0 to 4) As Byte spare_uc(0 to 16) As Byte End TypePublic Type BSC_COM_MSG message_head As MESSAGE_HEADER bsc_com_bscd As BSC_COM_BSC End Type
应该是phase(0 to 3) As Byte
Public Declare Function ose_com_send_msg Lib "mydll.dll" (ByVal chan_id As Integer, ByVal msg_len As Integer, ByRef tx_buf As Any, ByRef err_code As Long) As Integer
Public Type BSC_COM_TR
rece_ph As Byte
tran_ph As Byte
tran_da As Byte
rece_att As Byte
bit As Byte
work As Byte
tran_pow As Byte
End TypePublic Type BSC_COM_TRU
tru_tran_pow As Byte
tru_tran_da As Byte
work_array As Byte
tr(0 to 7) As BSC_COM_TR
End TypePublic Type BSC_COM_PH
phase(0 to 3) As Byte
att(0 to 3) As Byte
End TypePublic Type BSC_COM_BSC
lvps_key As Byte
hvps_key As Byte
k1 As Byte
k2 As Byte
k3 As Byte
int_tr As Byte
timer As Byte
ph(0 to 3) As BSC_COM_PH
tru(0 to 7) As BSC_COM_TRU
End TypePublic Type MESSAGE_HEADER
message_code_e As Integer
message_length_uh As Integer
time_tag_ul As Long
message_number_uh As Integer
message_channel_uc(0 to 4) As Byte
spare_uc(0 to 16) As Byte
End TypePublic Type BSC_COM_MSG
message_head As MESSAGE_HEADER
bsc_com_bscd As BSC_COM_BSC
End Type
这个我知道的第二个说的有道理,可惜,,,我也知道现在知道了,VB和VC字长不一致,在内存中的长度是不一样的。我已经改好了,谢谢楼上。