|
-
Apr 19th, 2003, 02:22 PM
#1
Thread Starter
Addicted Member
Problems with using VarPtr function
From VB project I call to method of ActiveX DLL written in C++.
The parameter is long (address in memory) received by using VarPtr function in VB (address of long variable ).
When I change the value of variable in C++ by received address (the address is correct) I dont get in VB correct result.
------------------------------------------------------------------------------------
VB code:
Dim MyObj As New NUMBERSTESTLib.CheckParams
Dim i as Long
MyObj.FunCheckParams VarPtr(i), StrPtr(str1)
C++ code:
STDMETHODIMP CheckParams::FunCheckParams(long iNumber, long sString)
{
long *intNumber = (long *)iNumber;
wchar_t *intString = (wchar_t *)sString; //Unicode converting
*intNumber = 33;
wcscpy(intString,_T("Test"));
return S_OK;
}
-----------------------------------------------------------------------------------
I want to get to my long variable defined in VB (i) the value that set in C++ (33)...
Functions VarPtr,StrPtr,ObjPtr are not documented and supported by Microsoft...
May be anybody has good samples of code how to use them?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|