Sample Code 3
Fortran module f90VBGUIUtils with subroutine DisplayError.
module f90VBGUIUtils
!load f90VB modules
use f90VBDefs
use f90VBBStrings
use f90VBVariants
use f90VBAutomation
implicit none
contains
subroutine DisplayError(ErrorMessage)
!procedure arguments
character(len=*),intent(in)::ErrorMessage
!internal variables
type(VARIANT)::CError, VarErrMsg
type(VARIANT)::VarTmp
integer(HRESULT_KIND)::iRet
!Create an instance of the CError object
CError= CreateOleObject('f90VBGUI.CError',iRet)
if (iRet.eq.S_OK) then
!Set its ErrorMessage property
VarErrMsg = VariantCreate(VT_BSTR,ErrorMessage)
call PropertyPut(CError,'ErrorMessage',VarErrMsg)
!Show the error window
VarTmp = ExecMethod(CError,'Show',VariantCreate(VT_BOOL,.true.))
!clean up
call Release(CError)
call VariantClear(VarErrMsg)
call VariantClear(VarTmp)
endif
end subroutine DisplayError
end module f90VBGUIUtils