AnsweredAssumed Answered

vrf using ActiveX on different windows versions

Question asked by VRFuser on Jan 21, 2008
> Is there a way of using ActiceX in a more platform independent way.

There are basically a couple of things you can do.

One way to ensure ActiveX success is to use version dependent ProgIDs. A version dependent ProgID specifies a particular version of an object (using a dot<number>, as in Excel.Chart.8 for instance), guaranteeing the existence of a certain level of functionality or behavior.

Another is check for the existence of an object before you instantiate it. This is more or less easy, all you have to do is check the registry to see if the ProgID key exists. These ProgIDs are kept in HKEY_CLASSES_ROOTProgID. HKCR is often used as a notational shorthand to make it easer to talk about these:

HKEY_CLASSES_ROOT   = HKCR
HKEY_CURRENT_USER   = HKCU
HKEY_LOCAL_MACHINE  = HKLM
HKEY_USERS          = HKUS
HKEY_CURRENT_CONFIG = HKCC

If you want to go a step further, pick up the CLSID subkey's default value and look for that key in HKCRCLSID. There you'll usually find a subkey named "InprocServer", with possibly a "32" or "64" appended to the key name. Check for the existence of the named file (named in the Default value).

InprocServers execute in the same process space with the client. If the server is not an inproc then you'll find a subkey named "LocalServer" with possibly a "32" or "64" appended. Check for the existence of that file.

Sometimes you'll find a subkey named "RemoteServer" with possibly a "32" or "64" appended. Check to make sure you have access to the named system, and possibly connect to that machine's registry & file system to check that the object is available.

These two can help a lot, giving you the opportunity to at least tell the operators that "thus and so needs to be installed" or "upgrade to version X of product Y".
-SHAWN-

Outcomes