contents   index   previous   next



BStrConvFromVB and BStrConvToVB

 

f90VB Modules

 

f90VBDefs, f90VBBStrings

Summary

 

Subroutines BStrConvToVB and BStrConvFromVB are used to convert a standard BString into/from the special format used by Visual Basic when passing BString arguments to/from API functions.

Syntax

 

subroutine BStrConvFromVB (BstrSrc,BStrHndl, iRet

 

integer(BSTRHNDL_KIND),intent(in):: BStrSrc
integer(BSTRHNDL_KIND),intent(inout):: BStrHndl
integer(HRESULT_KIND),intent(out),optional:: iRet

 

subroutine BStrConvToVB (BStrHndliRet

 

integer(BSTRHNDL_KIND),intent(inout):: BStrHndl
integer(HRESULT_KIND),intent(out),optional:: iRet

Arguments

 

BStrSrc [Input]

A handle to a BString in the special format used by Visual Basic to pass BStrings to external procedures.

 

BStrHndl [Input/Output]

For BStrConvFromVB, BStrHndl is a handle to store a standard-conforming copy of BStrSrc.

For BStrConvToVB, BStrHndl is a handle to a standard-conforming BString that will be converted into a Visual Basic external BString. The converted string is returned in the same handle.

 

iRet [Output, Optional]

Upon return, iRet contains the number of characters in BStrHndl, or BSTRINGS_ERROR if the procedure failed.

Comments

 

When Visual Basic calls an external function or subroutine (i.e. a function/subroutine specified with Visual Basic's DECLARE interface), BString arguments are automatically converted into a format that makes them compatible with C-ANSI strings. In spite of still being a BString, this format is not completely compatible with the standard OLE BStrings handled by f90VB. When a Fortran subroutine receives a BString argument from Visual Basic, it must call subroutine BStrConvFromVB to reformat the argument into an OLE-compatible BString. A Fortran subroutine that is returning a BString argument to a Visual Basic program must call subroutine BStrConvToVB to convert the argument into the special BString format that Visual Basic expects to receive back from external functions.

 

BStrSrc and BStrHndl can be the same variable in BStrConvFromVB.

 

Calls to these subroutines are not necessary if the arguments are passed as standard BStrings, for example when the Fortran subroutine calls an Automation-aware program, or if the Fortran DLL is called from Visual Basic through a type library definition.

Examples

 

See Chapters 2, 4 and 5 of the User Manual.

 


BStrReAlloc