HowTo Loading ActiveX dinamically at runtime ?

L

Leo sailer

Hi,
The point is the following I need to add ActiveX control dinamically in a
Webform. Currently I'm doing this using a literal control and "writing the
HTML Code" for example:

lit.Text = "<OBJECT id=Dtpicker1 name=Dtpicker1 height=24 width=90%
align=center classid='clsid:20DD1B9E-87C4-11D1-8BE3-0000F8754DA1' " >" & _
"<PARAM NAME='OLEDropMode' VALUE='0'>" & _
"<PARAM NAME='CalendarBackColor' VALUE='-2147483643'>" & _
"<PARAM NAME='CalendarForeColor' VALUE='-2147483630'>" & _
"<PARAM NAME='CalendarTitleBackColor' VALUE='-2147483633'>" & _
"<PARAM NAME='CalendarTitleForeColor' VALUE='-2147483630'>" & _
"<PARAM NAME='CalendarTrailingForeColor' VALUE='-2147483631'>" & _
"<PARAM NAME='CurrentDate' VALUE='3445565'>" & _
"<PARAM NAME='UpDown' VALUE='1'>" & _
"<PARAM NAME='MaxDate' VALUE='2958465'>" & _
"<PARAM NAME='MinDate' VALUE='-109205'>" & _
"</OBJECT>"
controls.add(lit).

It works but I want something cleaner, such as using AXHost, but that I can
added as a Web control, for example:

Dim AxDTPicker as new mscomct2.DateTimepicker

AxDTPicker.value = '3445565'

Controls.add(AxDTPicker)

Is any other way to add ActiveX controls dinamically ?

Thnaks
 
M

MasterGaurav

Why not create a custom control - derive it from Label and make cutom
elements (for params to the activeX).

Some example of new properties of the new control can be:
string CLSID
string Height
string Width
string Align (or Align Align, where Align is enum)
ParameterList Parameters (this is the list of parameters/values).

Override the Render method.

Now, you can host this control as custom control, like:

<prefix:ActiveXControl ... width=".." clsid="..." runat="server">
<prefix:parameter name="..." value="..." runat="server"/>
...
</prefix:ActiveXControl>


--
Cheers,
Gaurav Vaish
http://www.mastergaurav.org
http://mastergaurav.blogspot.com
--------------------------------
 
L

Leo sailer

Thanks for answering.
Create a custom control it is not an option, becuase I have to load several
Activex, some of them are very complex, migrate is the final idea, but now i
need to use the ActiveX currently running.

Thnaks
 
M

MasterGaurav

Ah! Couldn't response earlier.. was travelling.

Can you please elaborate on "need to use the Activex currently
running"? What exactly do you mean in this...

If you have "several complex" activeX, then I think there's no other
option than the current way. You may like to use Label instead of
literal text... but anyway, it doesn't matter.

If you are looking for AXHost for ASP.Net, you'd need to write the
code. IMHO, nothing is readily available as of now. May be you have a
look at http://www.asp.net if something is available.


--
Cheers,
Gaurav Vaish
http://www.mastergaurav.org
http://mastergaurav.blogspot.com
--------------------------------
 
L

Leo sailer

Thanks,
What i tried to explain was that the ActiveX are some applications that
people are accustomed to use them, but they are distribute in different
portals. I would like to put all in one portal, and add some other .net
webforms.
Due to the fact that these ActiVeX are "in production", I'd like, in this
stage, not to migrate to .Net, but I need to "load them" in a webforms in
runtime.

Anyway , thanks for all.

Talking about AxHost, do you know some links or something to learn about it ?.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,052
Latest member
LucyCarper

Latest Threads

Top