I am having a function in MATLAB I have converted it to a c dll, using the mcc option of MATLAB I have created a ActiveX control and I am able to access all the functions in that dll my problem is how to pass the variable from VC++ to that dll bcoz all the variables in that dll are of type Variant, I am getting the error that cannot convert double to struct tag variant....
any body who can help me in this regard ....
Thanx in advance!
VB pass string to VC
Change the ByRef to ByVal in the Declare-statement. Sending it as a ByRef will send it as it is defined internally in VB. ByVal will send the actual string and not the internal struct (something like length + string).
Public Declare Sub DeReceiveStringFromVB Lib "ConnIris" ( _
ByVal s1 As String, ByVal s2 As String)
I recently created a DLL that imnplements shared mamory functionality to use in a vb project. VB is unbelievable regarding string (and many others..). Its default behaviour is using BSTRs when you decalre a variable as String.
If your define a string inside a Type...EndType block, it passes it to the vc DLL as ANSI string.
I found out that it may be better to use the "Winapi aproach" when you want to return a string to a vb program. That means pass the buffer and the size of the buffer from the vb and use memcpy etc to copy the string.
buff=String(vbNullChar,255) '!!! initialize (allocate space)
GetMyName(byval buff as String,size as Long)
void WINAPI GetMyName(LPSTR buff,long size)
memset(buff,...,size); // or even strcpy
Remember though to initialize the string or declare it in VB like that:
Declare String * 255
If you don't do that, you just pass a buffer to fill that is not allocated! That means a nice crash :)
I want to extract properties of a control(MSHFlexGrid) Which is residing in other application .I have hooked control's thread by a dll.
I am getting all the properties of this contol if the application(In which control resides) is designed in vc++.
But I am not getting the properties if the application is in "VB"
Why is it so.
Please Help me
I've been trying to create my own DLL's to interact with VB. But no matter what I've done it doesn't seem to work. And now to my surprise, a demo project that is suppose to work comes up with the same error. "Can't find DLL entry point Test in dlldemo1.dll". I've been getting the same error for all of my trials. If anyone can't help, it would be appreciated.