Print Page | Close Window

Accessing Child Object from Pane.Handle

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Docking Pane
Forum Description: Topics Related to Codejock Docking Pane
URL: http://forum.codejock.com/forum_posts.asp?TID=399
Printed Date: 04 May 2024 at 2:22am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Accessing Child Object from Pane.Handle
Posted By: ianp
Subject: Accessing Child Object from Pane.Handle
Date Posted: 30 January 2004 at 3:14am

Hi,

I'm using the ActiveX docking pane control. Once I have created a Pane and set the Pane.Handle to the form to be used as the Child Window, I am trying to get access to the controls on the form of the Child Window.

Can anyone suggest how I can do this from the Pane.Handle? Ideally what I am looking for is something like:

Set frm = Pane.Handle

frm.command1.caption = "My New Value"

So the question really is, how do you turn a window handle (hwnd) into a vb form object?

Thanks

Ian

 

 

Using both




Replies:
Posted By: robs
Date Posted: 04 February 2004 at 9:33pm

Ian,

Will something like this work for you?:

Dim f As Form
Dim v As Variant
For Each v In Forms
    If v.hWnd = pane.Handle Then
      Set f = v
      Exit For
    End If
 Next

If Not f Is Nothing Then
  f.command1.Caption = "My New Value"
End If



Posted By: ianp
Date Posted: 06 February 2004 at 1:14pm

Thanks for your message. I had two appraoches to this: maintain a global/form variable with an array of pointers to the  forms; or get the form object back from a loop (as you suggested).

Dunno if it's just me but both seem kinda excessive so thought there maybe an API or function that I hadn't heard of.

Oh well, sticking with the "for f in forms" approach for now as  it appears faster and easier.

 




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net