VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Finding HWND of a dialog

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
263 Views, 2 Replies

Finding HWND of a dialog

I have to make a few calls that want an HWND and I have no idea on how to
obtain this for the dialog I have on screen. The only thing I know where to
find, is the ThisDrawing.HWND, but with the result that the dialog on screen
does not
go active on return from my calls.

Does anyone know where to get the HWND?
I saw somewhere that you might use FindWindow but that one requires a long
pointer to the caption. How do I get that (I'm quite new to VBA) ?

Thanks,
Nils
2 REPLIES 2
Message 2 of 3
joesu
in reply to: Anonymous

Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Dim hWnd As Long

hWnd = FindWindow vbNullString, "UserForm1"

Joe
--
Message 3 of 3
Anonymous
in reply to: Anonymous

Private Declare Function GetActiveWindow Lib "user32" () As Long

Public Property Get hWnd() As Long
hWnd = GetActiveWindow()
End Property


where needed, just use hWnd

===============================
Mike Tuersley
PhD @ CADalyst's AutoCAD Clinic
http://www.cadonline.com

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost