Logo

Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.

CLSID

The CLSID (read “class ID”) of a Server object is that ugly string of letters and numbers inside squiggly braces that OLE seems to love.

Usage

cClassID = oObject.CLSID

The Class ID is the “magic number” that distinguishes your OLE class definition from all others. This 16-byte number is (like all geeks, we can’t resist saying this) “unique across space and time” due to the GUID (Globally Unique IDentifier) algorithm used to generate it. Most introductory books on COM, ActiveX or OLE (whatever it’s called this week) can give you a good introduction to GUIDs.

So who cares? Well, the ID of your class becomes the link through which all other programs locate the information they need to know about your class in the Registry. The object’s class ID is registered on the target machine when you install your ActiveX control or server on that machine; you need to use the CLSID to go spelunking through the Registry while troubleshooting. VFP displays this number as a string, with each byte expressed in hexadecimal format.

You’ll see a second CLSID in this context—the unique identifier for the type library, rather non-polymorphically referred to within VFP as the TypeLibCLSID. While similar in format, it serves a different purpose. Check the Reference section for that one for more details.

Example

MODIFY PROJECT SYS2335 NOWAIT  && one of Ted's test projects
oProject = _VFP.ActiveProject
? oProject.Servers.Count  && displays the servers available, 1
oProject.Servers[1].CLSID  && display the Class ID for it
* In this case, {6F2ED0B5-087E-11D2-AD72-00C04FA30529}
* Let us know if one of your servers has the same CLSID

See Also

Project, Server, Servers, TypeLibCLSID