JohnYingling:
Thanks, I think you've solved the issue: you can pass non-variant data types to the COM object if the arguments are specified in the COM methods as ByVal. Since VB defaults to ByRef and I did not specify ByVal, I was getting a type mismatch error on string and long arguments...
jonscott:
Okay, did some more testing after your last post. It now appears that return values can be other data types, but function arguments must be variants. My DLL works in VBS with return values other than variant (long, etc.). However, if the public methods of the DLL have any input...
I'm not an expert on COM, but I think the issue may be that you can use strong typing in your component and use is successfully in VBScript *IF* the component includes a Type Library. However, I don't know how to create a type library with a VB component. Perhaps this is only a function of C...
Thanks for all comments. I made it work by changing all arguments and return values in DLL public functions to variants.
jonscott8:
Here are the function declarations in the DLL, both the original (which didn't work) and the new (which does):
Original:
Public Function...
Thanks for your response. Considered using RegRead, but wanted to store some of the data in the registry in encrypted form, and the DLL does that. Plus the VBScript is only part of a larger project that involves other languages, so wanted a consistent way to retrieve this data for all programs...
I have an ActiveX DLL to read database connection settings from the Windows registry. It works great in VB 6, but am trying to use it in VBScript. Whenever I call a method of the DLL class, I get a Type Mismatch error.
My code looks like this:
Dim sServer, sDB, sLogin, sPW
Dim oConn
Dim oReg...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.