I have a DLL that I've created and installed on my Pocket PC. It has a single function that looks like this:
---------------------------------------------
' Installed as \Windows\MyFunction.dll
Public Function MyFunction () as String
Return "Hello World"
End Function
---------------------------------------------
I have a separate desktop project that basically looks like:
---------------------------------------------
Public Sub Test ()
Dim iBytes As Byte() = StrToByteArray("") ' Just empty for now
Dim oBytes As Byte() = StrToByteArray("") ' Just empty for now
Dim myRAPI as New RAPI
myRAPI.Connect()
myRAPI.Invoke("\Windows\MyFunction.dll", "MyFunction", iBytes, oBytes)
myRAPI.Disconnect()
End Sub
Public Shared Function StrToByteArray(ByVal str As String) As Byte()
Dim encoding As New System.Text.ASCIIEncoding()
Return encoding.GetBytes(str)
End Function 'StrToByteArray
---------------------------------------------
Every time I run this, it says that the paramater "source" cannot be null. I searched around and someone said that this is because the Invoke function is calling an internal procedure that is returning a null, which probably just means that I'm not calling my function correctly. I looked around and it looks like I may need to create a certain signature for my "MyFunction" function for it to be able to be called correctly. But I cannot figure out quite how to do this (I think I ALMOST have it figured out based on CeRAPIInvoke's signature, but I can't find a way to implement the IRAPIStream type without C++).
My question is: can anyone put up an example of a properly-created function / signature in VB.net that can be compiled to a DLL, and then invoked by RAPI's Invoke method?
- Jonathan