handles in VBA

C

ctrl+X

hi all

(I'm quite cross posting, sorry, since I have already asked this question
elsewhere)
I'd like to use a multi-line tooltip in VBA, adapting the subs I found here:
http://www.vb-helper.com/howto_multi_line_tooltip.html

Unfortunately it's necessary to know the handles of forms and controls; in
VBA the handle of a form is easy to find:

Dim hFrm As Long
hFrm = FindWindow(vbNullString, Me.Caption)

But what about controls? I tried with EnumChildWindows :

....
EnumChildWindows hFrm, AddressOf EnumChildProc, ByVal 0&
....
Public Function EnumChildProc(ByVal hwnd As Long, ByVal lParam As Long) As
Long
Debug.Print hwnd
EnumChildProc = 1
End Function

But I have just learnt it's wrong, since EnumChildWindows expects true
windows-controls, while VBA-controls are "windowless controls"; in
microsoft.public.vb.winapi Mike D Sutton wrote :
"IIRC none of the controls on a VBA form are 'really' windows at least in
the way the OS defines them (and EnumChildWindows() expects them), but are
simply drawn onto the parent at runtime. This is the same behaviour as label
and image controls exhibit within VB, they're known as windowless controls"

Is it possible to retrieve those handles in VBA or is it simply impossible?
 
J

Jonathan West

Hi Ctrl-X

I think you may be out of luck. VBA controls are mostly windowless.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top