|
-
July 22nd, 2009, 06:08 AM
#4
Re: How to write a COM wrapper?
I hate to even comment because I really don't know C++ code, but from the looks of what you have posted there your MyDLLFunction isn't returning a value. If your MyDLLFunction doesn't provide a return value then you can't get a return value. Now maybe I'm putting my foot in my mouth because I don't under the C syntax. But for example if you want to define a variable of type object and set equal to the return value of a function then you would first have to have a function that returned an object.
Function MyDLLFunction() as Object
'code here
End Function
then you could call the function like this
Dim myX as object
Set myX = MyDLLFunction
The same is true for external dll calls
So Declare the function like this
Private(or public) Declare Function MyDLLFunction LIB "MyRegisteredDLL" () as Object
Then call the function in your code like this
Dim myX as object
Set myX = MyDLLFunction
Again, not understanding the C syntax I may be incorrect about your function returning a value, but if it returns an Object AND the function is a public function of the DLL then you can declare it and call it as shown.
By the way, I'm pretty sure that you have to stipulate a full path to the DLL file if it isn't in the Windows Search Path. You can look at your Path Environment variable and see if the directory your DLL is in is in there if not then you will have to give a full path to it in your declaration.
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
|