Trouble with char pointer in vb

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mario2
    New Member
    • Oct 2007
    • 1

    Trouble with char pointer in vb

    Hello.

    I'm having some trouble in trying to use functions from a C dll in VB.Net.
    I try to read a char array from memory with a pointer.
    This is how it is working in c++
    [CODE=cpp]typedef int ( WINAPI *INRECV )(int,int*,char *,int,int*,int) ;[/CODE]

    and this is what I wrote in vb.net

    [CODE=vbnet]Public Class Win32
    Public Declare Function inrecv Lib "INTCP32.dl l" (ByVal i As Integer, ByRef j As Integer, ByRef s As IntPtr, ByVal k As Integer, ByRef l As Integer, ByVal m As Integer) As Integer
    End Class

    Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As System.EventArg s) Handles Button1.Click
    Dim getdata As New IntPtr
    Dim lan As Integer

    lan = Win32.inrecv(i, j, getdata, 10, how, 10)[/CODE]

    I'm getting a Pointer but with Marshal.PtrToSt ringAuto(getdat a) I don't get anything.

    Can somebody help?
    I've read already hundreds of articles but couldn't solve this.

    Thanks.
    Last edited by Killer42; Oct 5 '07, 03:21 AM. Reason: Add CODE tags
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    Question moved to .NET Forum.

    Comment

    Working...