CLSID$ function

Purpose | Return a 16-byte GUID string (128-bit GUID format string) containing a CLSID associated with a unique ProgramID string of a COM object or component.
Syntax | a$ = CLSID$(ProgramID$)
Remarks | A CLSID string is a 128-bit (16-byte) binary string representing the GUID or UUID of a COM object/component. A CLSID string is not in a human-readable format. You can convert textual ID name of a COM object/component into a CLSID string with the CLSID$ function. CLSID examines the system registry in order to determine the CLSID string associated with the ProgramID$ string. The ProgramID$ parameter is not case-sensitive, so "MSAGENT.CONTROL.2", "MSAgent.Control.2" and "msagent.control.2" all refer to the same COM object/component. If the ProgramID$ cannot be found, or if any error occurs during the lookup and conversion process, CLSID$ will not set the ERR system variable, but will return an empty string. To convert the binary CLSID string into human-readable GUID/UUID format, use the GUIDTXT$ function. CLSID$ is the complement to the PROGID$ function. PowerBASIC programmers rarely, if ever, need to deal with CLSID strings in order to utilize a COM object or component.
a$ | The return string may be assigned to a dynamic string, fixed-length or nul-terminated string (at least 16 bytes long), or (typically) a GUID variable. See DIM for more information.
See also | DIM, GUID$, GUIDTXT$, INTERFACE (Direct), INTERFACE (IDBind), ISNOTHING, ISOBJECT, LET (with Objects), OBJECT, OBJACTIVE, OBJPTR, OBJRESULT, PROGID$, What does a Class look like?, What is an object, anyway?
Example | MSWordClassID$ = CLSID$("word.application.8") IF LEN(MSWordClassID$) = 16 THEN ' Success getting the CLSID$ of MSWord a$ = PROGID$(MSWordClassID$) 'a$ holds "Word.Application.8" b$ = GUIDTXT$(MSWordClassID$) 'b$ holds "{000209FF-0000-0000-C000-000000000046}" END IF