简体   繁体   中英

Passing HTML OBJECT PARAM to C# ActiveX

I've been given the task of updating an old OCX using C#. Everything works fine apart from one thing.

I've now been told that we need to add in a Param specifying a port.

The old HTML looked like this:

<object classid="clsid:D636293D-5687-4847-B53E-D4B4F3FABAD0" id="ActiveXTest3">
   <param name="Port" value="8085" />
</object>

The main requirement is that the code to display the control is kept in a static html page. No Javascript allowed (not sure why but it's what I've been told!)

Now doing some digging some posts say its not possible in .NET. Some say it is possible but hosting the object as an ASPX page. I've found some reference to using

 IPropertyBag

in my C# ActiveX Control but can't find any definitive solution or answer.

Can someone clear this up and if possible a simple example?

use a com visible interface and place there something like String Text { set;get;}

And, In the control class place something like

public String Text
{
    get
    {
        return mStr_Text;//  mStr_Text is private variable declared in the control class//
    }

    set
    {
        mStr_Text = value;
        this.label1.Text = value.ToString();// will change the label's Text
     }
}

After that you can place the param name as Text.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM