I'm trying to find the handle of a window but since it's class name changes everytime the window is opened i'm having some trouble.
I've found a bit of code that allows me to use wildcards to find the handle but i can't seem to figure out how to call the handle from my form.
Here is the bit of code i have in my module
VB Code:
Public Function EnumWindowsProc(ByVal hwnd As Long, ByVal lParam As Long) As Long Dim Length As Long Dim sName As String Length = GetWindowTextLength(hwnd) + 1 If Length > 1 Then sName = Space(Length) GetWindowText hwnd, sName, Length sName = Left$(sName, Length - 1) 'Use the Like operator to search with wildcards If sName Like "*The Wizard: Current Macro Set:*" Then MsgBox "The handle is: " & sName End If End If EnumWindowsProc = 1 End Function
The Message box i have in there is just for me to know if the function worked Properly, and this part does.
Anyone have any suggestions.




Reply With Quote