Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. EnumChildWindows

EnumChildWindows

Scheduled Pinned Locked Moved Visual Basic
beta-testingperformancehelpquestioncode-review
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Knoen
    wrote on last edited by
    #1

    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 :)

    D 1 Reply Last reply
    0
    • K Knoen

      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 :)

      D Offline
      D Offline
      Duncan Edwards Jones
      wrote on last edited by
      #2

      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

      K 1 Reply Last reply
      0
      • D Duncan Edwards Jones

        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

        K Offline
        K Offline
        Knoen
        wrote on last edited by
        #3

        Thank you for that! It works lika clockwork now :)

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups