internet-explorerwindows-764-bitocxcomdlg32

Common Font Dialog (comdlg32.ocx) not working on Windows 7 calling from JavaScript in IE


I tried the font dialog in VB6 with a form app and it could launch font dialog, but when I tried to do the same in javascript, it failed with exception:

Could not complete the operation due to error 800a8000

at line calling ShowFont().

Here is my html code: any ideas?

<html>
<head>
<title>test</title>
</head>

<script>

function doclick() {
        var fontDlg = document.all.fontDlg
  //var fontDlg = new ActiveXObject("MSComDlg.CommonDialog");

  /*
        cdlCCRGBInit = 1;
        cdlCCFullOpen = 2;
        cdlCCPreventFullOpen = 4;

        fontDlg.Flags = (cdlCCRGBInit | cdlCCFullOpen | cdlCCPreventFullOpen);
        fontDlg.CancelError = false;
        fontDlg.Min = 8;
        fontDlg.Max = 72;
        fontDlg.DialogTitle = "Change font settings";
        fontDlg.ShowFont();
        //fontDlg.ShowColor();
  */
  fontDlg.ShowFont();
}

</script>
<body>

<input type=button onclick=doclick() value="click me"/>

    <OBJECT id="fontDlg" style="LEFT: 224px; POSITION: absolute; TOP: 24px" classid="clsid:F9043C85-F6F2-101A-A3C9-08002B2F49FB" CODEBASE="http://activex.microsoft.com/controls/vb5/comdlg32.cab #Version=1,0,0,0">
        <PARAM NAME="_ExtentX" VALUE="847">
        <PARAM NAME="_ExtentY" VALUE="847">
        <PARAM NAME="_Version" VALUE="393216">
        <PARAM NAME="CancelError" VALUE="0">
        <PARAM NAME="Color" VALUE="0">
        <PARAM NAME="Copies" VALUE="1">
        <PARAM NAME="DefaultExt" VALUE="">
        <PARAM NAME="DialogTitle" VALUE="">
        <PARAM NAME="FileName" VALUE="">
        <PARAM NAME="Filter" VALUE="">
        <PARAM NAME="FilterIndex" VALUE="0">
        <PARAM NAME="Flags" VALUE="0">
        <PARAM NAME="FontBold" VALUE="">
        <PARAM NAME="FontItalic" VALUE="">
        <PARAM NAME="FontName" VALUE="">
        <PARAM NAME="FontSize" VALUE="">
        <PARAM NAME="FontStrikeThru" VALUE="0">
        <PARAM NAME="FontUnderLine" VALUE="0">
        <PARAM NAME="FromPage" VALUE="0">
        <PARAM NAME="HelpCommand" VALUE="0">
        <PARAM NAME="HelpContext" VALUE="0">
        <PARAM NAME="HelpFile" VALUE="">
        <PARAM NAME="HelpKey" VALUE="">
        <PARAM NAME="InitDir" VALUE="">
        <PARAM NAME="Max" VALUE="0">
        <PARAM NAME="Min" VALUE="0">
        <PARAM NAME="MaxFileSize" VALUE="260">
        <PARAM NAME="PrinterDefault" VALUE="1">
        <PARAM NAME="ToPage" VALUE="0">
        <PARAM NAME="Orientation" VALUE="1">
    </OBJECT>
</body>
</html>

Solution

  • I didn't solve it. I took Spudley's advice and removed the dependency from our web application. Instead I just made a HTML form with some font options. A lot easier and it works fine.