Results 1 to 6 of 6

Thread: How Can I Interact With The Main Form FromThe The Activex User Control?

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2001
    Posts
    14

    How Can I Interact With The Main Form FromThe The Activex User Control?

    Hello,

    I am creating and ActiveX user control. It is a title bar with exit minimize maximize buttons. Does anyone know how i can interact(send commands) with the main form that the user control will be on? Is there a keyword for it?

    Thanks.

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    Use Extender.Parent

    Best regards

  3. #3
    Hyperactive Member
    Join Date
    Oct 2001
    Location
    The Netherlands
    Posts
    403
    Public Declare Function ReleaseCapture Lib "user32" Alias "ReleaseCapture" () As Long

    Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

    Public Const WM_CLOSE = &H10
    Public Const WM_NCLBUTTONDOWN = &HA1
    Public Const WM_SIZE = &H5

    Public Const SIZE_MAXHIDE = 4
    Public Const SIZE_MAXIMIZED = 2
    Public Const SIZE_MAXSHOW = 3
    Public Const SIZE_MINIMIZED = 1
    Public Const SIZE_RESTORED = 0

    You will need this to create a titlebar I think. Let's have a look at Sendmessage:
    hwnd=hwnd of the window where your control is on.
    wMsg = one of the WM_ messages
    wParam = In case that wMsg = WM_SIZE use SIZE_ constants
    lParam = Case WM_Close: lparam = 0, WM_NCL.. specify coordinates, but for this case you can use 0, WM_SIZE: width = loword, height = hiword of lparam.

    Use this for dragging the window
    Private Sub Usercontrol_MouseDown(params)
    releasecapture
    sendmessage parent.hwnd, wm_nclbuttondown, 0, 0
    end sub

    This should work

  4. #4
    Hyperactive Member
    Join Date
    Oct 2001
    Location
    The Netherlands
    Posts
    403
    Oh I see someone else has posted while I was doing so much work . Ah doesn't matter, you can choose now what you want to use, and I'm going to look at his way. Maybe it's better, I don't know.

  5. #5

    Thread Starter
    New Member
    Join Date
    Jul 2001
    Posts
    14
    Thanks a lot guys

  6. #6
    Member
    Join Date
    Apr 2007
    Location
    Philippines/Japan
    Posts
    36

    Re: How Can I Interact With The Main Form FromThe The Activex User Control?

    Quote Originally Posted by Joacim Andersson
    Use Extender.Parent

    Best regards
    hi,

    How come this "Extender.Parent" is not working in IE?

    PS:
    I have an aspx page that holds an activex control.
    In this control I want to :

    Extender.Parent.Textbox1.Text = "Hello!"

    But nothing happens when I load the page. This works though in VB exe.

    Is there a way I can make it work?

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