Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to deploy ActiveX dll from web page
    primarykey
    data
    text
    <p>Been trying off and on for days now and can't figure this out. I have written a C# class file for an Intranet app to control the local serial ports. It works great when I manually register the dll using regasm, however, I need to deploy this control from a web page without having to manually register it. I tried creating a Setup Project in Visual Studio 2010, it compiled fine yet I can not open the object in a webpage.</p> <p>Here are the pertinent lines of code from my C# class:</p> <pre><code>namespace wmsSerialPorts { [Guid("55D31498-12A5-4FF0-942D-3B0BA449CA7B")] [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] [ComVisible(true)] public interface iAxDevices { [DispId(1)] int OpenPort(string sComPort); [DispId(2)] int ClosePort(); [DispId(3)] int SendCmd(string sCmd); [DispId(4)] string GetLastError(); //[DispId(5)] //string ReadLine(); [DispId(6)] string ReadWeight(); [DispId(7)] Microsoft.JScript.ArrayObject GetJsPorts(); [DispId(8)] void prtLabel(string sItemNum, string sQty, string sDesc, string sWoNum, string sBoxID, string sBoxIDBarCode, string sBoxIDorig); [DispId(9)] void prtLabelQC(string sItemNum, string sQty, string sDesc, string sWoNum, string sBoxID, string sBoxIDBarCode, string sBoxIDorig, string sNeedDate, string sRecOverride); [DispId(10)] void prtReset(); } [Guid("E59C5B7E-EF1F-4241-A9FD-191EF8FCC167")] [ClassInterface(ClassInterfaceType.None)] [ComVisible(true)] [ProgId("AxDevices")] public class AXDevices : wmsSerialPorts.SerialCom, iAxDevices, wmsSerialPorts.IObjectSafety </code></pre> <p>As I mentioned, if I use regasm wmsSerialPorts.dll, the object works great when called from JavaScript like this:</p> <pre><code>myAx = new ActiveXObject("AXDevices"); </code></pre> <p>My Setup project contains a wmsSerialPorts.inf file:</p> <pre><code>[version] signature="$CHICAGO$" AdvancedINF=2.0 [Setup Hooks] install=install [install] run=msiexec.exe /package """%EXTRACT_DIR%\ActiveXSetup.msi""" /qn </code></pre> <p>.... and an ActiveXBuild.ddf file:</p> <pre><code>.Set DiskDirectoryTemplate=cab .Set CabinetNameTemplate=ActiveXSetup.cab Debug\ActiveXSetup.msi wmsSerialPorts.inf </code></pre> <p>My wmsSerialPorts.dll file is properly referenced as a detached asseembly and building the Setup Project created the ActiveXSetup.cab and ActiveXSetup.msi files as expected.</p> <p>I then created this HTML page to load the object:</p> <pre><code>&lt;!DOCTYPE&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Test&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;!-- &lt;object id="AXDevices" classid="clsid:E59C5B7E-EF1F-4241-A9FD-191EF8FCC167" codebase="https://10.0.2.53/BIDWMS/ActiveXSetup.cab"&gt; &lt;/object&gt;--&gt; &lt;object id="AXDevices" classid="clsid:E59C5B7E-EF1F-4241-A9FD-191EF8FCC167" codebase="ActiveXSetup.cab"&gt; &lt;/object&gt; &lt;script type="text/javascript"&gt; try { var obj = document.AXDevices; if (obj) { alert(obj.SayHello()); } else { alert("Object is not created!"); } } catch (ex) { alert("Error message is: " + ex.Description); } &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>... but when I run the page, it generates an error of "undefined" (from the catch(ex) block). Any ideas? Thanks in advance ....... Bob</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload