Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DBI Tech Listbar in Toolbar
Message
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
01660432
Message ID:
01660450
Views:
47
>>>>Hi,
>>>>
>>>>I have a toolbar control (which I created many years ago) that displays the DBI Tech Listbar ActiveX. This toolbar is in a VCX library (e.g. main_toolbar in MyTools.vcx). When I open the Toolbar in the IDE (I think this is VFP standard toolbar), it has the DBI Tech Listbar. The application main.prg instantiates this toolbar. And I think, in turn, the toolbar instantiates the DBI Tech Listbar. The problem is that when a user does not have the DBI Tech Listbar registered, the following error occurs:
>>>>
>>>>"OLE error code 0x800040153 Class not registered" 
>>>>
>>>>
>>>>How can I change this so that I can catch the error with a Try/Catch? Because Try Catch around instantiating the VFP toolbar does not work. That is, the OLE Error happens first, and then Catch of the toolbar.
>>>>
>>>>TIA
>>>
>>>Find out the CLSID of the control, and before instanciating it, go to the registry and confirm that it is registered, otherwise skip the instanciation.
>>
>>Thank you for your suggestion. I have two concerns about this approach:
>>1. I am not comfortable getting into the registry from the VFP application (actually never done it)
>>2. This would have to be done on every start of the application. Which could slow down the start. Or, even worse, if the code does not find the registry, it would create false problem.
>>
>>I was hoping that the check for ActiveX registration could be done with Try/Catch.
>
>Here is what we do, we have some clients that have an older version of an activex we use, and some with the new one, There is a program in Foxpro that allows you to read the registry, It goes something like this:
>
*** Create the OutlookBar toolbar. Check to see if
>*   the new format exists. Otherwise use the old version.
>lnHKEY_LOCAL_MACHINE = 0x80000002
>loReg = newobject("REGISTRY", "REGISTRY.PRG", "avalibr.app")
>if file(sys(16,0) + ".manifest") ;
>or loReg.OpenKey("SOFTWARE\Classes\TypeLib\{812085D3-6D58-4724-8A78-FBC1653517D6}\7.0", ;
>				lnHKEY_LOCAL_MACHINE) = 0
>	this.tbrOutlookBar = CREATEOBJECT("tbrOutlookBarNew")
>else
>	this.tbrOutlookBar = CREATEOBJECT("tbrOutlookBar")
>endif  
>
Thank you for the code.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform