By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,997 Members | 1,657 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,997 IT Pros & Developers. It's quick & easy.

ActiveX Cab File - How to use in C#

P: n/a
Short Version of Question:

Can anyone provide an example of how I should embed the ActiveX and license,
and then use it in a function?


LongerVersion:
I am attempting to convert an asp file to a asp.net file using C#.

The original file has an ActiveX control which is contained in a cab file.

The cab file contains the .ocx file which connects to a socket and transfers
client info to a server, as well as several .dlls

The cab file also references another cab file which contains files to
install on the client machine in case they do not have VBRuntime6 installed
on their machine.

We have obtained a Microsoft license for the ActiveX control.

My problem is, how to call or reference the control in my .net page. I have
researched and am doing what I have seen, but am getting errors.

The original code has the ActiveX embedded in the html like so:
<form runat="server" name="trade_entry_verify" method="post">
..
..
..
<P>
<OBJECT CLASSID="clsid:blah_blah_blah"
id="Microsoft_Licensed_Class_Manager_1_0"1 VIEWASTEXT>
<PARAM NAME="LPKPath" VALUE="NAME.lpk">
</OBJECT>
<OBJECT id=IDNAME2 height=0 width=0
classid=clsid:blah_blah_blah codeBase="CABNAME.CAB#version=1,0,0,0"
VIEWASTEXT>
<PARAM NAME="_ExtentX" VALUE="873">
<PARAM NAME="_ExtentY" VALUE="847">
</OBJECT>
</P>
..
..
..
</form>


One of the functions is like so (note- : trade_entry_verify is the form
name):
<script language="vbscript">
..
..
..
function doSubmit()
trade_entry_verify.IDNAME2.CloseSocket
trade_entry_verify.IDNAME2.HostAddress = "ip.address.0.0"
trade_entry_verify.IDNAME2.Port = "portnum"
Result = trade_entry_verify.citcp2.ConnectToHost
end function
..
..
..
</script>


In my C# code, I have embedded the two objects in the html as shown above
since the examples I have found seem to do the same.

Yet, when I try to preview the page in IE, I get the following error:

Compiler Error Message: BC30451: Name 'trade_entry_verify' is not declared.

Source Error:
Line 85:
Line 86: function doSubmit()
Line 87: trade_entry_verify.CITCP2.CloseSocket
Line 88: trade_entry_verify.CITCP2.HostAddress = "ipaddressIuse"
Line 89: trade_entry_verify.CITCP2.Port = "2000"

trade_entry_verify is simply the form name, so I tried removing it and then
I get:
Compiler Error Message: BC30451: Name 'CITCP2' is not declared.

Source Error:
Line 85:
Line 86: function doSubmit()
Line 87: CITCP2.CloseSocket
Line 88: CITCP2.HostAddress = "ipaddressIuse"
Line 89: CITCP2.Port = "2000"

for this page, to get started and for testing purposes, I simply cut and
pasted the VBScript function within the script tags. Ultimately, I wish to
rewrite it as C#.

Can anyone provide an example of how I should embed the ActiveX and license,
and then use it in a function? Any help would be really, really appreciated.
Dec 1 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
ActiveX controls with CAB files can be used in ASP.NET in the same fashion as
they are used in HTML or classic ASP.

However, they normally cannot be used as server-side objects. You will need
to script the standard HTML object tag within the ASPX page. Normally ActiveX
controls must be instantiated at the client-side. The developer will be
responsible for passing data back and forth between the server and the client
systems.

If you have an example code where the component is actually instantiated as
a COM component in server-side VBScript for example, it might be possible to
translate that to the equivalent C# code and mark the ASP.NET page with
ASPCOMPAT=true.

Hope this helps.
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Frank" wrote:
Short Version of Question:

Can anyone provide an example of how I should embed the ActiveX and license,
and then use it in a function?


LongerVersion:
I am attempting to convert an asp file to a asp.net file using C#.

The original file has an ActiveX control which is contained in a cab file.

The cab file contains the .ocx file which connects to a socket and transfers
client info to a server, as well as several .dlls

The cab file also references another cab file which contains files to
install on the client machine in case they do not have VBRuntime6 installed
on their machine.

We have obtained a Microsoft license for the ActiveX control.

My problem is, how to call or reference the control in my .net page. I have
researched and am doing what I have seen, but am getting errors.

The original code has the ActiveX embedded in the html like so:
<form runat="server" name="trade_entry_verify" method="post">
..
..
..
<P>
<OBJECT CLASSID="clsid:blah_blah_blah"
id="Microsoft_Licensed_Class_Manager_1_0"1 VIEWASTEXT>
<PARAM NAME="LPKPath" VALUE="NAME.lpk">
</OBJECT>
<OBJECT id=IDNAME2 height=0 width=0
classid=clsid:blah_blah_blah codeBase="CABNAME.CAB#version=1,0,0,0"
VIEWASTEXT>
<PARAM NAME="_ExtentX" VALUE="873">
<PARAM NAME="_ExtentY" VALUE="847">
</OBJECT>
</P>
..
..
..
</form>


One of the functions is like so (note- : trade_entry_verify is the form
name):
<script language="vbscript">
..
..
..
function doSubmit()
trade_entry_verify.IDNAME2.CloseSocket
trade_entry_verify.IDNAME2.HostAddress = "ip.address.0.0"
trade_entry_verify.IDNAME2.Port = "portnum"
Result = trade_entry_verify.citcp2.ConnectToHost
end function
..
..
..
</script>


In my C# code, I have embedded the two objects in the html as shown above
since the examples I have found seem to do the same.

Yet, when I try to preview the page in IE, I get the following error:

Compiler Error Message: BC30451: Name 'trade_entry_verify' is not declared.

Source Error:
Line 85:
Line 86: function doSubmit()
Line 87: trade_entry_verify.CITCP2.CloseSocket
Line 88: trade_entry_verify.CITCP2.HostAddress = "ipaddressIuse"
Line 89: trade_entry_verify.CITCP2.Port = "2000"

trade_entry_verify is simply the form name, so I tried removing it and then
I get:
Compiler Error Message: BC30451: Name 'CITCP2' is not declared.

Source Error:
Line 85:
Line 86: function doSubmit()
Line 87: CITCP2.CloseSocket
Line 88: CITCP2.HostAddress = "ipaddressIuse"
Line 89: CITCP2.Port = "2000"

for this page, to get started and for testing purposes, I simply cut and
pasted the VBScript function within the script tags. Ultimately, I wish to
rewrite it as C#.

Can anyone provide an example of how I should embed the ActiveX and license,
and then use it in a function? Any help would be really, really appreciated.

Dec 1 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.