1
votes

I have an HTA which contains an object tag for an ActiveX control. The ActiveX control is properly registered on my machine:

<object classid="clsid:AAAA0DA1-F887-449E-8A1A-875DCC047977" id="editor"></object>

When I double click on the batch file to run it, everything works great. However, if I launch the HTA from a batch file, the ActiveX controls fail to load. The page loads fine, and I can see the rest of the content, but there is a red X where the Ax control should be.

My batch file looks like this:

START mshta.exe MyHTA.hta
1

1 Answers

0
votes

Are you running a 64-bit version of Windows? Is the ActiveX control 32-bit? If this is the case, the start command in your shell script (batch file) is starting the 64-bit version of mshta.exe to run your HTA. You could do the following so your shell script (batch file) works whether the current OS is 32-bit or 64-bit:

@echo off
setlocal
set MSHTA=
if defined PROCESSOR_ARCHITEW6432 (
  set MSHTA=%SystemRoot%\system32\mshta.exe
) else (
  set MSHTA=%SystemRoot%\SysWOW64\mshta.exe
)
start %MSHTA% MyHTA.hta
endlocal

Bill