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