Navigation:  ThinBASIC Language > thinBasic Functions > String functions >

PROGID$

Previous pageReturn to chapter overviewNext page

 

Description

 

Return the unique PROGID string (text) associated with a unique CLSID string of a COM object or component.

 

Syntax

 

s = PROGID$(ClassId)

 

Returns

 

String

 

Parameters

 

Name

Type

Optional

Meaning

ClassId

String

No

A string or a GUID variable representing the GUID of a COM object/component

 

Remarks

 

You convert the 16-byte (128-bit) binary class ID of a COM object/component into a PROGID string with the PROGID$ function.

 

PROGID$ takes the (16-byte) binary string ClassID$ representing the GUID or UUID of a COM object/component, and examines the system registry in order to determine the PROGID string associated with the ClassID$ string. ClassID$ may be a dynamic string or fixed-length string of at least 16 bytes, or (typically) a GUID variable.

 

If the ClassID cannot be found, or any error occurs in the lookup process, PROGID$ will return an empty string.

 

PROGID$ is the complement to the CLSID$ function. Using these two functions together, it is possible to extract the precise capitalization of the PROGID from the system registry. See the example below.

 

Restrictions

 

See also

 

CLSID$

 

Examples

 

uses "Console"

 

DIM MSWordClassID AS GUID

 

MSWordClassID = CLSID$("Word.Application")

IF TRIM$(MSWordClassID, $NUL) <> "" THEN

 

  '---Success getting the CLSID$ of MSWord

  Printl "ProgID:"PROGID$(MSWordClassID)

 

  '---

  PrintL "ClsId: "GUIDTXT$(MSWordClassID)

 

Else

  printl "It seems Microsoft Word is not installed."

END IF

 

printl "---Al done press a key to end---"

WaitKey