Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to know, at run time, if MSCHART20.OCX is there ?
Message
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
00976491
Message ID:
00976519
Views:
11
>I have a VFP8 app that uses MSCHART20.OCX for some graphics. Not all the users have it (only those having office I think) and, at this point, I cannot run a new setup for all the users. Is there a way, in the application, to verify if the ocx is there and registered ?

Eric,

I think the easiest way would be at application startup to try to instantiate a chart object and see if it succeeds:
oChart = NEWOBJECT("MSChart20Lib.MSChart.2")
You would probably need an error handler (either ON ERROR or TRY/CATCH) in case the NEWOBJECT fails, which would mean that the class doesn't exist on the machine. If there's no error, then you know it exists and you can release the object variable from memory.

Another way to check would be to make use of VFP's registry foundation class and search the registry under HKEY_CLASSES_ROOT for the class name mentioned above.

Laterness,
Jon
Jon Rosenbaum
Devcon Drummer
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform