Click here to Skip to main content
15,887,892 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

sometimes, during startup of an application, an error message pops up saying "attempted an unsupported operation". The reason is usually that I forgot to register an OCX file. While this is easy to fix, it is far more difficult to say which OCX (several OCXs are used in that application) is not registered. It usually required a lot if guesswork, or breaking into MFC code and reading the stack trace up to a point where I can find the control ID. This is ok while I am in office but when service staff are trying to upgrade software we cannot debug.
I'd like to intercept this error so that I can show a message like "The blah blah component is not registered." However the message box is generated in MFC code so that I have no chance to handle an exception before it is caught. I tried to step through this code to find out whether it calls any virtual functions to handle the error, but couldn't find any.
I wonder whether I can validate the dialog resource to find all OCXs and try to instantiate them via COM before the dialog is created so that I can output a message which contains the GUID of those OCXs which cannot be loaded. By the way, I was talking of dialogs but in fact several applications use the document/view model, so the solution must be a more general one (not just overriding a CDialog member function). We are using plain non-managed VC++ code with lots of MFC.
Thank you for any ideas or comments.

Hans
Posted

1 solution

The best way is to throw the ocx out of your code, most of them can easily get replaced. Check whether they correspond with an IE Version, so check the installes IE. (a problem with Windows XP)

This behaviour points also that you havent an approbiate setup program for your app. ->msi

you must find all ocx in the sourcecode or the resource file and check them all.
 
Share this answer
 
Comments
hans.sch 19-Jul-11 2:00am    
Karsten, I agree with you but my boss doesn't, so I'll have to stick to what we have (or we don't have, as far as the installer is concerned) :-(
KarstenK 19-Jul-11 3:04am    
Check which ocx you need and get some installer, or write some code. A simple batch does often the work.

You really need an installer if the app is installed on many machines or without personal reach of your team.


Consider get your bosses job or look for a better carrier ;-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900