Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27367

VS 2010 Pointer to License file path.

$
0
0
Hi,
In my project I want to make a function to a DLL and the call in C++ is like this:

Code:

short Get_Processed_Image_Data(unsigned short *pInImageData, unsigned short *pOutImageData, int Columns, int char *pLicenseFile);
Where, "*pLicenseFile" is pointer to path of license file.

Now, I'm making the same call in VB.NET, this way:

Code:


<DllImport("ProcessImage.dll")> Public Function Get_Processed_Image_Data(ByVal pInImageData As IntPtr, ByRef pOutImageData As IntPtr, ByVal iWidth As Integer, ByVal iHeight As Integer, ByVal _pLicenseFile As IntPtr) As Short

End Function

Now, I have created pointers to "InputImageBuffers" and "OutputImageBuffers" like this:

Code:


 Dim _pInputImageDataBufferUShort As IntPtr
 Dim _pOutputImageDataBufferUShort As IntPtr
 Dim InputImageDataUShort((Rows * Columns) - 1) As UShort
 Dim OutputImageDataUShort((Rows * Columns) - 1) As UShort

 _pInputImageDataBufferUShort = AllocHGlobal(InputImageDataUShort.Length)
 _pOutputImageDataBufferUShort = AllocHGlobal(OutputImageDataUShort.Length)

 Dim InputArrayHandle As GCHandle = GCHandle.Alloc(InputImageDataUShort, GCHandleType.Pinned)
        _pInputImageDataBufferUShort =InputArrayHandleHandle.AddrOfPinnedObject

 Dim OutputArrayHandle As GCHandle = GCHandle.Alloc(OutputImageDataUShort, GCHandleType.Pinned)
        _pOutputImageDataBufferUShort =OutputArrayHandleHandle.AddrOfPinnedObject

Now I am not getting a way to create a pointer to a string variable which shall hold the path of license file.

The string variable holding path of license file is declared this way:

Code:

Dim LicensePath As String = AppDomain.CurrentDomain.BaseDirectory & "ProcessImage.dll"
Can any body please tell me or post code bit to create pointer to string variable holding path of the DLL. The DLL file is placed in application bin\ debug folder.

Also, is my way of making a DLL call is correct, or should I also include any attributes with the DLL import call?


Regards,
Susheelss.

Viewing all articles
Browse latest Browse all 27367

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>