A
Andrew Jones
Hi,
I'm trying to send data via a custom dll created in embedded C++ and use the
dll in VB.Net Compact Framework for the PDA.
I can pass boolean values but for some reason my string value isn't being
passed. It's just null on the VB.NET CF side.
Below is a sample DLL's code in embedded C++:
-----------------------------------START
#include "stdafx.h"
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
extern "C"
{
__declspec(dllexport) bool Test(BSTR testStr)
{
wsprintf(testStr, _T("This is a test. [%S]"), __FILE__);
return true;
}
}
----------------------------------------END
Below is my VB.NET CF Code. The 1st message box returns the correct boolean
value ok but the 2nd one shows null for the string.
---------------------------------------START
<DllImport("test.dll")> _
Private Function Test(ByVal thiswillwork As String) As Boolean
End Function
-------
Dim strTeststring As String
Dim blnYESORNO As Boolean
blnYESORNO = Test(strTeststring)
MsgBox(blnYESORNO)
MsgBox(strTeststring)
===================================END
Thanks for any help!
Andrew Jones
I'm trying to send data via a custom dll created in embedded C++ and use the
dll in VB.Net Compact Framework for the PDA.
I can pass boolean values but for some reason my string value isn't being
passed. It's just null on the VB.NET CF side.
Below is a sample DLL's code in embedded C++:
-----------------------------------START
#include "stdafx.h"
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
extern "C"
{
__declspec(dllexport) bool Test(BSTR testStr)
{
wsprintf(testStr, _T("This is a test. [%S]"), __FILE__);
return true;
}
}
----------------------------------------END
Below is my VB.NET CF Code. The 1st message box returns the correct boolean
value ok but the 2nd one shows null for the string.
---------------------------------------START
<DllImport("test.dll")> _
Private Function Test(ByVal thiswillwork As String) As Boolean
End Function
-------
Dim strTeststring As String
Dim blnYESORNO As Boolean
blnYESORNO = Test(strTeststring)
MsgBox(blnYESORNO)
MsgBox(strTeststring)
===================================END
Thanks for any help!
Andrew Jones