472,811 Members | 1,301 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,811 software developers and data experts.

ActiveX Cab File - How to use in C#

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
1 5065
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: wang xiaoyu | last post by:
Hello: i want use activex in wxpython program,but when i use MakeActiveXClass an exception occurs. this is my source code dealing the DICOM ocx.I must note that in this program "hwtxcontrol" is...
12
by: A.M. | last post by:
Hi at all, how can I do to insert into a HTML page a file .txt stored in the same directory of the server where is the html file that must display the text file.txt? Thank you very much P.Pietro
5
by: Turner | last post by:
Hi there, I'm not a flash programmer myself but I work with some of them. It seems whenever I browse to a page developped by these folks the browser receives it as if there were ActiveX content...
0
by: Ike | last post by:
I have an Activex Control created in VB6, which, displays no problem on any machine I have, but, on some machines of others, it does not. All machines are running either XP or Windows 2000, and all...
1
by: Craig | last post by:
I am having problems getting an ActiveX DLL written in VB6 to call a method in a C# class library component. My C# DLL is called CSharpProject.dll and contains a public class called CSharpClass....
21
by: Strath-Clyde | last post by:
I'm a die hard c# developer, developing win32 and web based enterprise apps for last few years. The development team I'm on is going down a path I feel is wrong. I scoping out the web to knock...
5
by: Andrew | last post by:
Hi all, I am still getting into ASP/VB.net and have a concern about something I see coming. Currently our entire website is classic ASP, yet the feelings from on high is that we need to start...
0
by: Frank | last post by:
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?
3
by: eusebiu | last post by:
Hello... I am developing a MFC ActiveX that I want to self register when IE promts to Install it. I have added the VALUE "OLESelfRegister", "\0" to activex's resource file (.rc) and I have...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.