Strings, VBScript & COM Objects 
Author Message
 Strings, VBScript & COM Objects

All variables in VBScript are VARIANTS. I have a COM automation object (dll)
written in C ++
tha is called from an Outllok Form VBSCRIPT. The outmation needs to get
strin information back to the VBSCRIPT in some manor. Returning int or
shorts is easy but, I cannot seem to beable to pass back a sting value
properly.

Can someone point me in the correct direction.

                                Westley L. Hespeth
                                BAH



Mon, 30 Apr 2001 03:00:00 GMT  
 Strings, VBScript & COM Objects
I think you need to use the BSTR.  VBScript can handle types coming in just
fine (in fact, there is a sub type function that lets you determine what
variant subtype it is).  However, everything leaving VBScript is a variant
(unless wrapped in a CStr(), CInt(), etc.)

Quote:

>All variables in VBSCRIPT are VARIANTS. I have a COM automation object
(dll)
>written in C ++
>tha is called from an Outllok Form VBSCRIPT. The outmation needs to get
>strin information back to the VBSCRIPT in some manor. Returning int or
>shorts is easy but, I cannot seem to beable to pass back a sting value
>properly.

>Can someone point me in the correct direction.

>                                Westley L. Hespeth
>                                BAH



Tue, 01 May 2001 03:00:00 GMT  
 Strings, VBScript & COM Objects
Answer my  own question to some extent and would like to post the
information for those others:

You can pass  back a "BSTR" to a vbscript variant.

When defining the function in your automation object you can define it as
shuch:

BSTR MyFunction (void);

The dispatch macro would be something like:

DISP_FUNCTION  (MyClass, "MyFunction",  MyFunction, VT_BSR, VTS_NONE)

Int the function:

{
BSTR myBSTR =  L"This is a test" // L denoting that the string is a BSTR
string not a plian ASCII string

return MyBstr;

Quote:
}

Westley L. Hespeth
All-Speth Software

http://www.all-speth.com
410-969-5999
410-206-8048

Quote:

>All variables in VBSCRIPT are VARIANTS. I have a COM automation object
(dll)
>written in C ++
>tha is called from an Outllok Form VBSCRIPT. The outmation needs to get
>strin information back to the VBSCRIPT in some manor. Returning int or
>shorts is easy but, I cannot seem to beable to pass back a sting value
>properly.

>Can someone point me in the correct direction.

>                                Westley L. Hespeth
>                                BAH



Wed, 02 May 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Strings, VBScript & COM Objects

2. COM-Object in ASP with COM-Object as parameter

3. COM-Object in ASP with COM-Object as Parameter

4. VBScript calling to a COM object that expects a user-defined object

5. Passing a String as a parameter to a (VB-) COM-Object

6. Using VBScript COM Object to parse and run VBScripts scriplets

7. Access a COM object of a COM object?

8. Accessing a COM object of a COM object

9. com object will not read registry when com object called from asp (vb works fine)

10. COM Object-Out of stack space on executing/shell exe from com object

11. Call VB DLL or COM object from within VB COM object or EXE

12. VBScript, COM Events & Safe Arrays

 

 
Powered by phpBB® Forum Software