EnumChildWindows
-
When i call it like this:
Public Delegate Function EnumFuncDeleg(ByVal hwnd As Long, ByVal lParam As System.Text.StringBuilder) As Long Declare Function EnumChildWindows Lib "user32" (ByVal hWndParent As Long, ByVal lpEnumFunc As EnumFuncDeleg, ByVal lParam As Long) As Long ' ' ' Inside function EnumChildWindows(ProcessInfo.Handle, AddressOf EnumChildWindow, Nothing)
I get an error saying that: System.AccessViolationException was unhandled Message="An atempt was made to read protected memory, this often inditaces that memory is corrupt." What could be wrong? It dosent mater what window i try to enum, i allways get the same results :( :( :( All feedback is welcome :) Thanks :) -
When i call it like this:
Public Delegate Function EnumFuncDeleg(ByVal hwnd As Long, ByVal lParam As System.Text.StringBuilder) As Long Declare Function EnumChildWindows Lib "user32" (ByVal hWndParent As Long, ByVal lpEnumFunc As EnumFuncDeleg, ByVal lParam As Long) As Long ' ' ' Inside function EnumChildWindows(ProcessInfo.Handle, AddressOf EnumChildWindow, Nothing)
I get an error saying that: System.AccessViolationException was unhandled Message="An atempt was made to read protected memory, this often inditaces that memory is corrupt." What could be wrong? It dosent mater what window i try to enum, i allways get the same results :( :( :( All feedback is welcome :) Thanks :)Your delegate declaration is awry - the lParam parameter should be an Int32 Also - in VB.net a 32 bit number is not a Long - replace all instances of Long with Int32.
Public Delegate Function EnumFuncDeleg(ByVal hwnd As Int32, ByVal lParam As Int32) As int32 Declare Function EnumChildWindows Lib "user32" (ByVal hWndParent As Int32, ByVal lpEnumFunc As EnumFuncDeleg, ByVal lParam As int32) As int32 ' ' ' Inside function EnumChildWindows(ProcessInfo.Handle, AddressOf EnumChildWindow, Nothing)
'--8<------------------------ Ex Datis: Duncan Jones Merrion Computing Ltd
-
Your delegate declaration is awry - the lParam parameter should be an Int32 Also - in VB.net a 32 bit number is not a Long - replace all instances of Long with Int32.
Public Delegate Function EnumFuncDeleg(ByVal hwnd As Int32, ByVal lParam As Int32) As int32 Declare Function EnumChildWindows Lib "user32" (ByVal hWndParent As Int32, ByVal lpEnumFunc As EnumFuncDeleg, ByVal lParam As int32) As int32 ' ' ' Inside function EnumChildWindows(ProcessInfo.Handle, AddressOf EnumChildWindow, Nothing)
'--8<------------------------ Ex Datis: Duncan Jones Merrion Computing Ltd