Monday, September 10, 2007

[VC++] Dialog not showing up - ActiveX kicked my butt

Problem: Dialogs/Windows contaning ActiveX controls won't display.
Solution: MSCOMCTL.OCX (or some other OCX library) missing and/or not registered.

I'll tell you in a few a lines about a recent problem I had with ActiveX controls.
An old VC++ 6 software that had always worked before stopped working when we received a new set of dell production machines. No difference at all between new machines and old ones.
The application wasn't crashing but some dialogs were not showing up and I had no idea. The only clue was that the software started working on machines with VC++ 6 (VS6) installed.
After a day spent comparing the system32 directory of the machines and googling like crazy, I decided to start with the first hands-on approach (borrowed from Giulio Concas, a brilliant old teacher o'mine): FLY IN THE NIGHT, AKA "No idea about what to do". Given some similar problems solved this way on some forums I decided to convert the application to the .NET environment (a real pain inthe ass of newer standards compliance) 'cause "maybe this will fix it": Obviously it didn't.
Then I spent some time tracking the dll dependencies with (dependency walker) and went replacing all runtime dlls. Nothing.
Forgot to tell that the new machines were bounded to heavy devices and they didn't have any internet connection. So I couldn't neither debug remotely nor locally (installing VS6 the application would've started working).

The situation was quite desperate given such a silly problem.

After spending several hours trying stupid things and complaining about everything, I was pointed in the right direction on a forum (CodeGuru): when you don't have ActiveX controls registered windows couldn't display properly (or at all) without crashing. The beahviour was the same but I didn't know I had ActiveX controls on the dialogs so I just went back trying everything and hoping in a miracle. After a bit of time I noticed a progress bar I had on a dialog was an ActiveX control (Thought it was just a standard ProgressBar!), so I recalled everything and I was able to pack up and solve the problem.

MSCOMCTL.OCX was missing on the new machines (WinXP SP2, when I say new I mean 2007 stuff): go figure it. Moreover, go figure WHY Microsoft decided to stop shipping this stuff with XP.

This ridiculous mess took 3 working days, and I was just saved by the bell, as usual.

2 comments:

Scuffia said...

Dear Jhonny,
you are an asshole without doubts, but I recognize it was a hard task to be solved, like that I tried to solve last week (with Java insted of .NET).
I hope your experience will give me a stronger knowledge of ActiveX.
Thanks for living

Johnny Idol said...

I can do better than that, I am doing it right now. Maybe you'll read about it