EnumChildWindows?
-
Im trying to enum the childwindows of a application, but when i use the EnumChildWindows in the Windows 32 api i get "A protected area of the memory could not be read" How is it supposed to be done? This is what i have so far.
' Inside main function Call EnumChildWindows(ProcessInfo.Handle, AddressOf EnumFunc, 0) ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' The enum func Public Function EnumFunc(ByVal hwnd As Integer, ByVal lpData As Integer) As Integer Dim lResult As Integer Dim sWndName As String Dim szClassName As String EnumFunc = 1 szClassName = Space(MAX_PATH) sWndName = Space(MAX_PATH) lResult = GetClassName(hwnd, szClassName, MAX_PATH) szClassName = Left(szClassName, lResult) GetWindowText(hwnd, sWndName, MAX_PATH) sWndName = Left(sWndName, lResult) Debug.Print(sWndName + Chr(13)) End Function ' Deligate Public Delegate Function EnumFuncDeleg(ByVal hwnd As Integer, ByVal lpData As Integer) As Integer
Any ideas? -Thanks -
Im trying to enum the childwindows of a application, but when i use the EnumChildWindows in the Windows 32 api i get "A protected area of the memory could not be read" How is it supposed to be done? This is what i have so far.
' Inside main function Call EnumChildWindows(ProcessInfo.Handle, AddressOf EnumFunc, 0) ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' The enum func Public Function EnumFunc(ByVal hwnd As Integer, ByVal lpData As Integer) As Integer Dim lResult As Integer Dim sWndName As String Dim szClassName As String EnumFunc = 1 szClassName = Space(MAX_PATH) sWndName = Space(MAX_PATH) lResult = GetClassName(hwnd, szClassName, MAX_PATH) szClassName = Left(szClassName, lResult) GetWindowText(hwnd, sWndName, MAX_PATH) sWndName = Left(sWndName, lResult) Debug.Print(sWndName + Chr(13)) End Function ' Deligate Public Delegate Function EnumFuncDeleg(ByVal hwnd As Integer, ByVal lpData As Integer) As Integer
Any ideas? -ThanksApplication.OpenWindows, from memory, lets you iterate over the open windows of an app.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )