control handles and VBA

Discussion in 'AutoCAD' started by antmjr, Feb 17, 2005.

  1. antmjr

    antmjr Guest

    hi all
    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?
     
    antmjr, Feb 17, 2005
    #1
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 (here). After that, you can post your question and our members will help you out.