How To Reference To Win32 Object Under Ms Windows 7 64bit In Vbscript
Solution 1:
It wasn't clear when you first posed the question that the VBScript was being run inside an Internet Browser (assuming Internet Explorer as built-in support for VBScript in other browsers is none existent).
In the scenario where an Internet Browser is being used the same rules when dealing with multiple architectures applies. Instead of the client being the scripting host (cscript
or wscript
) the Internet Browser takes on this role.
We thus have to make sure we are using the correct architecture version of the browser.
x64 (64 Bit)
%ProgramFiles%\Internet Explorer\iexplore.exe
x86 (32 Bit)
%ProgramFiles(x86)%\Internet Explorer\iexplore.exe
If the wrong architecture version of the Internet Browser is executed the CreateObject()
function will look in the wrong part of the registry for the corresponding ProgId
(sapi.spvoice
), which can lead to errors like this:
Error: ActiveX component can't create object Code: 800A01AD Source: Microsoft VBScript Runtime Error
This is more common with applications that are solely 32 bit as the 64 bit part of the registry will never contain the corresponding registered COM components.
You may sometimes find that for whatever reason you have to register the COM DLL manually which can also be confusing for some. It's important to understand the differences.
Register a x64 COM DLL
%SystemRoot%\System32\regsvr32.exe
Register a x86 COM DLL
%SystemRoot%\SysWOW64\regsvr32.exe
It's also important to note that this only applies to 64 bit Windows Operating Systems as 32 bit ones will just contain the 64 bit equivalent locations. Both %ProgramFiles(x86)
and SysWOW64
are locations specific to 64 bit Windows Operating Systems only.
Post a Comment for "How To Reference To Win32 Object Under Ms Windows 7 64bit In Vbscript"