Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get hwnd of Controls on a form 3

Status
Not open for further replies.

sugarflux

Technical User
Aug 14, 2003
111
GB
Hi guys

I need to get the handle of controls on one of my forms. I'm returning the form hWnd with the FindWindow function and i've attempted using the enumchildwindows procedure to no avail.

I'm sure this must be an easy thing to accomplish using an api call - but which one !?

As i'm working in VBA from Excel obvioulsy i'm a bit more limited than working directly from VB..

Let me know if more info is needed..

Thanks

sugarflux
 
what is it that you are trying to achieve - there may be a native way to do it without API calls....

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Hi Geoff

Hmmm... Interesting question (one you'll probably regret asking!)

I'm actually trying to class a frame to behave as a userform. To allow it to be resized and moved around the form etc. I'm not quite sure of the extent of the work required at the moment but the first step is definately to get the hWnd of the frame.....

sugarflux
 
Some controls have hWnd, other not. The control has hidden _GethWnd method. Try:
Code:
Private Sub CommandButton1_Click()
MsgBox Me.OptionButton1.[_GethWnd]
End Sub

Private Sub CommandButton2_Click()
MsgBox Me.MultiPage1.[_GethWnd]
End Sub


combo
 
ditto that !

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
I'm recently much slower than Geoff. An insider?

combo
 
must be a mystery admirer combo !

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Hmmm.. secret admirers.. insiders... this forum is more exciting than anyone would have thought

Down to the difficult bit now.. trying to make a frame behave like a form using a class module. I'll start with allowing the frame to resize.. If anyone has any advice please don't hold back!

Thanks again

sugarflux
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top