Visual Studio 2005 MFC Wizard Error
The Problem
I needed to research behavior of some low-level system API, so I decided to write a small GUI application in C++ using MFC. This was a first time after a long break. To my amazement, I discovered that there are troubles with Visual Studio MFC wizard.
I was trying to add a variable to a dialog by double-clicking on one of the controls (which happened to be a check box, but it does not really matter). On double-click I received the following JavaScript exception:
After that the wizard continuted to work (sort of). The "type" field in the wizard dialog was jammed, and the variable type came out as "undefined" in the code.
Hunting It Down
I traced this error down to a problem with the WizCombo ActiveX control that is used by the wizard:
ProgId = VsWizard.WizCombo.8.0,
CLSID = {d4d285dd-2447-11d7-8bf6-00b0d03daa06}
I put this control in an IE page by itself:
<html>
<body>
Text Before<br/>
<OBJECT ID="VariableType" CLASSID="CLSID:d4d285dd-2447-11d7-8bf6-00b0d03daa06" TABINDEX="2">
</OBJECT>
<br/>
Text after
<script language="jscript">
try
{
alert("typeof(VariableType): " + typeof(VariableType));
VariableType.Clear();
window.alert("hoo");
}
catch (e)
{
alert("Exception: " + e.message);
}
</script>
</body>
</html>
The page came up with a warning about disabled IE addons:
The add-on manager had WizCombo control marked as disabled. Since the control was disabled, it was not possible to properly instantiate it on the wizard screen, or call its methods. This was the ulitmate source of the exception on double-click.
I could not enable the control, because of the group policy (see below).The Solution
I have found an article in the News Groups about the subject:
http://groups.google.com/group/microsoft.public.vc.ide_general/msg/eee147023d93d016?hl=en&
Dave Calkins
I'm using Visual C++ 2005 and have added a dialog to my project. As usual, |
Windows group policy allows to restrict loaded ActiveX controls to a specific list (see http://support.microsoft.com/kb/883256).
A list of the allowed add-ons is kept here:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Ext\CLSID
and in a similar key in the HKEY_LOCAL_MACHINE
.
If you have enough rights to write to this key, it is possible to manually add
REG_SZ {d4d285dd-2447-11d7-8bf6-00b0d03daa06} = "2"
which will enable the WizCombo add-on.