Public Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function GetClassName Lib "user32.dll" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, nMaxCount As Long) As Long
Private Sub FindHandle()
Dim hForm As Long, rv As Long
Dim s As String
hForm = FindWindow(vbNullString, "UserForm1")
Debug.Print hForm
s = String(256, "x") 'Creates a string with 256 x's
rv = GetClassName(hForm, s, 255)
Debug.Print Left(s, rv)
End Sub
|