contents   index   previous   next



GUIDToStr

 

f90VB Modules

 

f90VBDefs, f90VBAutomation

Summary

 

Converts a Global Unique Identifier (GUID) into its string representation.

Syntax

 

subroutine GUIDToStr (TGUID,GUIDStr,iRet)

type(GUID),intent(in)::  TGUID
character(len=*),intent(out):: GUIDStr
integer(HRESULT_KIND),intent(out),optional:: iRet

Arguments

 

TGUID [Input]

A Global Unique Identifier (GUID) structure.

 

GUIDStr [Output]

A string containing the character-style representation of TGUID. The string must be at least thirty-eight characters long.

iRet [Output/Optional]

Upon return, iRet contains the number of characters in GUIDStr or a negative error code. See comments for more information.

Comments

 

Subroutine GUIDToStr does not check that the GUID passed in argument TGUID is registered in your system.

Argument iRet

 

Indicates success or failure of the subroutine. If the subroutine is successful, a positive value indicating the number of characters in GUIDStr is returned (this value is always 38). If the subroutine fails, iRet will contain E_UNEXPECTED to indicate an unexpected OLE error, or BSTRINGS_ERROR to indicate that argument GUIDStr is not long enough to contain the full GUID string.

Examples

 

program GUIDToStrExample

 

!Demonstrates the use of GUIDToStr, StrToGUID

!ProgIDToCLSID and CLSIDToProgID

!Copyright 1999-2000, Canaima Software

!All rights reserved

 

!load f90VBModules

use f90VBDefs

use f90VBAutomation

implicit none

 

character(len=100)::ProgID

type(GUID)::TCLSID,TGUID

character(len=30)::TGUIDStr

integer(HRESULT_KIND)::iRet

 

call OleInitialize()

 

!Get the CLSID for this object (CLSIDs are GUIDs)

call ProgIDToCLSID('MSComDlg.CommonDialog',TCLSID,iRet)

 

!Get the string representation of this CLSID

call GUIDToStr(TCLSID,TGUIDStr,iRet)

print *,'CLSID of MSComDlg.CommonDialog:'

print *,TGUIDStr

 

!Get the CLSID from its string representation

call StrToGUID(TGUIDStr,TGUID,iRet)

print *,''

print *,'TGUID Content:'

print *,'TGUID%Data1:',TGUID%Data1

print *,'TGUID%Data2:',TGUID%Data2

print *,'TGUID%Data3:',TGUID%Data3

print *,'TGUID%Data4():',TGUID%Data4

 

!Get the ProgID of this CLSID

call CLSIDToProgID(TGUID,ProgID,iRet)

print *,''

print *,'ProgID of Class ' // TGUIDStr //':'

print *,trim(ProgID)

 

call OleUnInitialize()

 

stop

end

Related Topics

 

For information about: See:
Obtaining a GUID from its string representation StrToGUID
Obtaining a Program ID from its Class ID CLSIDToProgID

 


Invoke