CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Jun 2001
    Posts
    4

    How to pass parameters from HTML page to ActiveX control

    You can invoke activeX control from HTML page using CLSID and can pass the parameters using PARAM tag.But how can we access these parameters in activeX control.
    Can anyone help?


  2. #2
    Join Date
    Apr 2000
    Posts
    737

    Re: How to pass parameters from HTML page to ActiveX control

    I might misunderstood your question, but the PARAM parameters should be the property of the activeX control which of course accessible by the activeX control itself.

    for instance, I got the code in a HTML file

    <OBJECT ID="Label1" WIDTH=200 HEIGHT=67
    CLASSID="CLSID:978C9E23-D4B0-11CE-BF2D-00AA003F40D0">
    <PARAM NAME="Caption" Value="testing">
    <PARAM NAME="ForeColor" Value="16777215">
    </OBJECT>

    as you can see, I pass two parameters to the activeX control (a normal label control), i.e. Caption & ForeColor.

    if you want to access the parameters in the activeX itself, it would be .Caption & .ForeColor



    HTH

    cksiow
    http://vblib.virtualave.net - share our codes

  3. #3
    Join Date
    Jun 2001
    Posts
    4

    Re: How to pass parameters from HTML page to ActiveX control

    Ok you have passed parameters Caption and foreColor to ActiveX control.
    If now I want to print this Capion on UserControl_Initialize() how can it do it.
    I tried with UserControl1.Caption but giving error
    DO I have to create property for Caption in ActiveX Control.

    Following is code I have written but giving error

    Private Sub UserControl_Initialize()
    MsgBox Caption
    MsgBox UserControl1.Caption
    End Sub



  4. #4
    Join Date
    Apr 2000
    Posts
    737

    Re: How to pass parameters from HTML page to ActiveX control

    DO I have to create property for Caption in ActiveX Control - yap, you do.



    HTH

    cksiow
    http://vblib.virtualave.net - share our codes

  5. #5
    Join Date
    Jun 2001
    Posts
    4

    Re: How to pass parameters from HTML page to ActiveX control

    But it still not working.

    I will write what I have done.

    HTML Code :--

    <HTML>
    <BODY topmargin=0 leftmargin=0 rightmargin=0 bottommargin=0>
    <OBJECT ID="project1" WIDTH=300 HEIGHT=200
    CLASSID="CLSID:73310882-63E6-11D5-B368-0000F6C1326C">
    <PARAM NAME="GetName" VALUE="Rajesh">
    </OBJECT>
    </BODY></HTML>


    AciveX Control Code :---

    Option Explicit
    Private ls_name As String


    Private Sub UserControl_Initialize()
    MsgBox ls_name
    End Sub


    Public Property Get GetName() As String
    GetName = ls_name
    End Property

    Public Property Let GetName(ByVal vNewValue As String)
    ls_name = vNewValue
    End Property




    Instead of showing "Rajesh" value passed from HTML page it is not showing any thing.

    I want to display "Rajesh" in MsgBox the value passed from HTML page.

    Why it's not working.Please help.



  6. #6
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: How to pass parameters from HTML page to ActiveX control

    Private Sub UserControl_Initialize()
    MsgBox ls_name
    End Sub

    this is displaied when you create the object, event that happens before you set the property...
    Make a new method (= a public sub in your activex)
    and call it after setting object value from page.
    Or, in Property Let sub add this line
    msgbox ls_name




    Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, Bruno Paris and all the other wonderful people who made and make Codeguru a great place. Come back soon, you Gurus.
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  7. #7
    Join Date
    Apr 2000
    Posts
    737

    Re: How to pass parameters from HTML page to ActiveX control

    Cimperiali has answered.


    HTH

    cksiow
    http://vblib.virtualave.net - share our codes

  8. #8
    Join Date
    Jun 2001
    Posts
    4

    Re: How to pass parameters from HTML page to ActiveX control

    Still not working.

    I have written following code for ActiveX control .I have added Command button and on click of it I am displaying "parameter passed from HTML page"

    Still not taking value from HTML page.
    Do you have any sample application with you so that you can send me.

    New Code written on ActiveX control

    Option Explicit
    Public ls_name As String


    Public Sub Command1_Click()
    MsgBox ls_name
    End Sub

    Public Sub UserControl_Initialize()
    MsgBox ls_name
    End Sub


    Public Property Get GetName() As String
    GetName = ls_name
    End Property

    Public Property Let GetName(ByVal vNewValue As String)
    ls_name = vNewValue
    MsgBox ls_name
    End Property


    Code on HTML page remains same as

    <HTML>
    <BODY topmargin=0 leftmargin=0 rightmargin=0 bottommargin=0>
    <OBJECT ID="project1" WIDTH=300 HEIGHT=200
    CLASSID="CLSID:73310882-63E6-11D5-B368-0000F6C1326C">
    <PARAM NAME="GetName" VALUE="Rajesh">
    </OBJECT>
    </BODY></HTML>



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured