Hi,
ich wollte folgende C++ dll in ein Vb.net Tool einbinden, bekomme aber keine gültige Antwort.
Note: the callback-function must look like this:
//
// void __stdcall YourCallBack(BYTE *Buff, int len) // or __fastcall if you need it
// {
// do your stuff here...;
// }
//
// when this function is called then there are len bytes at Buff
//
// Return value: true = filter & socket successfully set, and lpFunc will be called on data arrival
// false = either filter or socket could not be created
//
// Example: SetFilter(17,&YourCallBack,2,2,&filter_num); the "&" is important, if you don't write it, it'll make you mad!
// Sets a filter for pid 17 using YourCallBack-function which is stdcall and you want 4k-blocks
STREAMREADER_API BOOL SetFilter(WORD pid,void* lpFunc, DWORD CallBackType, DWORD size, DWORD *lpfilter_num);
Habe es so probiert:
Public Class Form1
Private Sub Button3_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim i As Short
Dim MeStream As MySRead
MeStream = AddressOf ReadDataFunction
'For i = 1 To TextBox7.Text
RichTextBox1.Text = RichTextBox1.Text & Chr(13) & "SetFilter " & SetFilter(TextBox7.Text, MeStream, TextBox8.Text, TextBox9.Text, &H0)
RichTextBox1.Text = RichTextBox1.Text & Chr(13) & "DelFilter " & Streame.DelFilter(0)
'Next
End Sub
Public Shared Function ReadDataFunction(ByVal buff As Byte, ByVal Leg As Int16) As Object
A2 = buff
A1 = Leg
End Function
#Region "Dll- Import"
<DllImport("streamreader.dll")> _
Public Shared Function SetFilter(ByVal PID As Int16, ByVal ReadDataFunction As Object, ByVal CallBackTyp As Int16, ByVal Size As Int16, ByVal filter_num As Int16) As Boolean
End Function
#End Region
#Region "Delegate-Deklaration"
Public Delegate Function MySRead(ByVal buff As Byte, ByVal Leg As Int16) As Object
#End Region
End Class
Kann mir jemand weiterhelfen, wo der Fehler liegt
cu
ich wollte folgende C++ dll in ein Vb.net Tool einbinden, bekomme aber keine gültige Antwort.
Note: the callback-function must look like this:
//
// void __stdcall YourCallBack(BYTE *Buff, int len) // or __fastcall if you need it
// {
// do your stuff here...;
// }
//
// when this function is called then there are len bytes at Buff
//
// Return value: true = filter & socket successfully set, and lpFunc will be called on data arrival
// false = either filter or socket could not be created
//
// Example: SetFilter(17,&YourCallBack,2,2,&filter_num); the "&" is important, if you don't write it, it'll make you mad!
// Sets a filter for pid 17 using YourCallBack-function which is stdcall and you want 4k-blocks
STREAMREADER_API BOOL SetFilter(WORD pid,void* lpFunc, DWORD CallBackType, DWORD size, DWORD *lpfilter_num);
Habe es so probiert:
Public Class Form1
Private Sub Button3_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim i As Short
Dim MeStream As MySRead
MeStream = AddressOf ReadDataFunction
'For i = 1 To TextBox7.Text
RichTextBox1.Text = RichTextBox1.Text & Chr(13) & "SetFilter " & SetFilter(TextBox7.Text, MeStream, TextBox8.Text, TextBox9.Text, &H0)
RichTextBox1.Text = RichTextBox1.Text & Chr(13) & "DelFilter " & Streame.DelFilter(0)
'Next
End Sub
Public Shared Function ReadDataFunction(ByVal buff As Byte, ByVal Leg As Int16) As Object
A2 = buff
A1 = Leg
End Function
#Region "Dll- Import"
<DllImport("streamreader.dll")> _
Public Shared Function SetFilter(ByVal PID As Int16, ByVal ReadDataFunction As Object, ByVal CallBackTyp As Int16, ByVal Size As Int16, ByVal filter_num As Int16) As Boolean
End Function
#End Region
#Region "Delegate-Deklaration"
Public Delegate Function MySRead(ByVal buff As Byte, ByVal Leg As Int16) As Object
#End Region
End Class
Kann mir jemand weiterhelfen, wo der Fehler liegt
cu