I'm trying to run activex control for a simple hello world message box. First i created the class library and i have now the dll , then i created the HTML page and called the activeX control :
<!DOCTYPE>
<html>
<head>
<title>DemoActiveX</title>
</head>
<body>
<OBJECT id="DemoActiveX" classid="clsid:400DCE17-4B26-4E59-9A88-AF39E2BE4A55">
</OBJECT>
<script type="text/javascript">
try {
var obj = document.DemoActiveX;
if (obj) {
alert(obj.SayHello());
} else {
alert("Object is not created!");
}
} catch (ex) {
alert("Some error happens, error message is: " + ex.Description);
}
</script>
</body>
</html>
when i tried it in my machine i used to register the dll using regasm /codebase "dll path" and it worked fine.
The problem when i tried to run in another machine, i followed the coming steps : 1) I created setup project and added the dll file.
[version]
signature="$CHICAGO$"
AdvancedINF=2.0
[Add.Code]
ActiveX.dll=ActiveX.dll
[ActiveX.dll]
file-win32-x86=thiscab
clsid=400DCE17-4B26-4E59-9A88-AF39E2BE4A55
FileVersion=1,0,0,0
[version]
signature="$CHICAGO$"
AdvancedINF=2.0
[Setup Hooks]
install=install
[install]
run=msiexec.exe /package """%EXTRACT_DIR%\DemoActiveXSetup.msi""" /qn
3) I created .CAB file which contains the .inf and setup.exe files 4) Changed the object in HTML page to be :
<OBJECT id="DemoActiveX" classid="clsid:400DCE17-4B26-4E59-9A88-AF39E2BE4A55"
codebase="ActiveXCAB.CAB" ></OBJECT>
when i tried to open the page on the other machine a request windows opened which request to open CAB ,when i press yes nothing happened !!!!! why it doesn't open the setup.exe or msi file ?? BTW when i installed manually the setup file the activeX worked !
I solved the problem :) The problem was :
1) I used to put msi file only or setup.exe in CAB file but i must put both msi and setup.exe and refer to setup.exe in inf file
2) inf file format was wrong , the correc one is :
[version]
signature="$CHICAGO$"
AdvancedINF=2.0
[Add.Code]
setup.exe=setup.exe
[setup.exe]
file-win32-x86=thiscab
clsid={415D09B9-3C9F-43F4-BB5C-C056263EF270}
FileVersion=1,0,0,0
[Setup Hooks]
RunSetup=RunSetup
[RunSetup]
run="%EXTRACT_DIR%\setup.exe"
Good Luck :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With