Click here to Skip to main content
15,867,986 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
See more:
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 :

HTML
<!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.
2) I created .inf file and tried two contents which are :

[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
RegisterServer=yes

---OR---

[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 :

HTML
<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 !
Posted
Updated 26-Dec-12 4:38am
v2
Comments
bbirajdar 26-Dec-12 12:18pm    
it depends on activex settings in browser http://www.ehow.com/how_6202033_enable-activex-internet-explorer-8.html
Sergey Alexandrovich Kryukov 26-Dec-12 18:21pm    
Why?!
—SA

Why using ActiveX at all? For a Web application, this is pure evil. ActiveX is proprietary and aging technology which will never be available on all client systems. Moreover, using ActiveX is considered unsafe, for good reasons, so really knowledgeable users will deny using your application as soon as they know it requires support of ActiveX in browser. By these reasons, this practice cannot be considered legitimate. My advice is: get rid of it as soon as possible. Stay out of trouble.

—SA
 
Share this answer
 
Comments
Zoltán Zörgő 26-Dec-12 18:27pm    
Agree. 5!
Sergey Alexandrovich Kryukov 26-Dec-12 18:28pm    
Thank you, Zoltán.
—SA
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 :
VB
[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 :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900