How to use a Function from C Language Created dll (unmanaged code)

Jun 21 2008 1:29 AM

Hi, 

 I have a C Language dll file with a .h and .lib file. I want to use the functions which is in this dll file. But as the dll is written in C, the code in dll is unmanaged. But i got some sucess to crack some functions.

But the function below i haven't find any solution.

Function in dll

 

PeripheralStatus(HWND hwnd, unsigned char *SenseKey, unsigned char     *SensorStatus);

 

hWnd - Handle of the application windows which will receive the notification messages.

SenseKey -   Pointer to a byte variable that will contain the sense key status.

SensorStatus - Pointer to a four bytes variable that will contain 16 bytes of sensor status.

       

 

Code in VB.Net Program

<DllImport("CFunc.dll")> _

Public Function PeripheralStatus( ByVal hWnd As IntPtr , ByRef SenseKey As Byte , ByRef StatusByte As Byte ) As Integer

End Function

I Use this function on a Button Click Event

 

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim sensekey As Byte

Dim statuskey As Byte

PeripheralStatus(IntPtr.Zero, sensekey, statuskey)

MsgBox(sensekey & " " & statuskey)

End Sub

In sensekey it return 0 Which means Peripheral is Ok

 

In statuskey it returns 64 which is 40 in HexaDecimal. But this is only first Byte.

Three Bytes more it should return but I don't know how it will return.

 

Please help me. If any querys please forward me.

 

Thanks

 


Answers (2)