Just nu i M3-nätverket
Gå till innehåll

Hjälp med c++ till vb.net


johan_

Rekommendera Poster

Hej

Jag håller just nu på med ett litet projekt med ett videokort, där SDK är skriven i C++ men jag vill ha det i VB.NET

Jag har lyckas att översätta många delar, men nu så har jag kört fast

 

 

Här är C++ koden

 

CPLAYER_API LONG __stdcall MP4_ClientStart(PCLIENT_VIDEOINFO pClientinfo,void(CALLBACK *ReadDataCallBack)(DWORD nChannel,UCHAR *pPacketBuffer,DWORD nPacketSize));

 

Och det är den här sista biten jag inte förstår

"void(CALLBACK *ReadDataCallBack)(DWORD nChannel,UCHAR *pPacketBuffer,DWORD nPacketSize)"

 

 

||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

Beskrivning över funktionen

 

3. MP4_ClientStart

This function starts a connection. The format of the call is:

 

LONG __stdcall MP4_ClientStart(PCLIENT_VIDEOINFO pClientinfo,

void(*ReadDataCallBack)(DWORD nChannel,UCHAR *pPacketBuffer,DWORD nPacketSize))

 

Parameters

pClientinfo holds the information. of this connection.

nChannel holds the channel of card.

pPacketBuffer holds the pointer to the receive buffer.

nPacketSize holds the length of the receive buffer.

 

Return Values

If the function succeeds the return value is the context of this connection.

If the function fails the return value is -1.

 

Remarks

typedef struct{

BYTE m_bRemoteChannel;

BYTE m_bSendMode;

BYTE m_bImgFormat;

char *m_sIPAddress;

char *m_sUserName;

char *m_sUserPassword;

BOOL m_bUserCheck;

HWND m_hShowVideo;

} CLIENT_VIDEOINFO, * PCLIENT_VIDEOINFO;

m_bRemoteChannel holds the channel which the client wants to connect to.

m_bSendMode holds the network mode of the connection.

m_bImgFormat : Image format, 0 is main channel video, 1 is sub channel video

m_sIPAddress holds the IP address of the server.

m_sUserName holds the user’s name.

m_sUserPassword holds the user’s password.

m_bUserCheck holds the value whether sends the user’s name and password or not.

m_hShowVideo holds Handle for this video window.

 

If m_hShowVideo holds NULL, the client can be record only without decoder.

If m_bUserCheck is FALSE, we will send m_sUserName and m_sUserPassword as NULL, else we will send each 50 bytes.

The length of m_sIPAddress and m_sUserName must be more than 50 bytes.

 

ReadDataCallBack: When the library receives a packet from a server, this callback is called.

 

||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

 

 

Och här är min VB.net kod

__________________________________

 

Public Class LCB_Client

 

Public Structure CLIENT_VIDEOINFO

Public m_bRemoteChannel As Byte

Public m_bSendMode As Byte

Public m_bImgFormat As Byte

Public m_sIPAddress As String

Public m_sUserName As String

Public m_sUserPassword As String

Public m_bUserCheck As Boolean

Public m_hShowVideo As Long 'hWnd

End Structure

 

 

Public Declare Function MP4_ClientStart Lib "hikclient.dll" (ByVal Clientinfo As CLIENT_VIDEOINFO, ????????? ) As Long

 

 

Private Sub LCB_Client_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

 

Dim Clientinfo As New CLIENT_VIDEOINFO()

Clientinfo.m_bRemoteChannel = 1

Clientinfo.m_bSendMode = 1

Clientinfo.m_bImgFormat = 0

Clientinfo.m_sIPAddress = "193.168.1.100"

Clientinfo.m_sUserName = "1"

Clientinfo.m_sUserPassword = "a"

Clientinfo.m_bUserCheck = False

Clientinfo.m_hShowVideo = Nothing

 

MP4_ClientStart(Clientinfo, ?????????)

End Sub

End Class

 

 

Några tips??

Länk till kommentar
Dela på andra webbplatser

Arkiverat

Det här ämnet är nu arkiverat och är stängt för ytterligare svar.

×
×
  • Skapa nytt...