Skip to content

module to find handles

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #187078
    autopilot
    Member

    A while back, I had shared a module (mdlGetHnd.vb) I created to make finding handles a bit easier. Well I will now share a more compact, cleaner module I have developed to do the same thing. To use it, add the module to you VB 2008 project and then call into it. It has 3 public functions:

      FindMainWindow(wndclass, title)
      GetChild(MainClass, MainCaption, ChildClass, ChildIndex)
      GetChild(ParentHandle, ChildClass, ChildIndex)

    For demonstration purposes, if you wanted to find the “Edit” window of NotePad, you could do it this way:


    Dim sClass As String = "Notepad"
    Dim sCaption As String = "- Notepad"
    Dim sSubClass As String = "Edit"
    Dim iSubIndex As Integer = 1
    Dim wHnd As IntPtr = mdlHnd.GetChild(sClass, sCaption, sSubClass, iSubIndex)

    Or you can split it like this:


    Dim sClass As String = "Notepad"
    Dim sCaption As String = "- Notepad"
    Dim sSubClass As String = "Edit"
    Dim iSubIndex As Integer = 1
    Dim wHndParent As IntPtr = mdlHnd.FindMainWindow(sClass, sCaption)
    Dim wHnd As IntPtr = mdlHnd.GetChild(wHndParent, sSubClass, iSubIndex)

    So those who have used my mdlGetHnd should be used to the needed variables.

    #187081
    String
    Member

    Handy and helpful, well done.

    #187080
    Departure
    Member

    Nice work Autopilot, And good to see your still around. btw where in states are you again? I’m over here in new Orleans for awhile.

    #187079
    autopilot
    Member

    Great to hear from you Dep!
    @Departure wrote:

    I’m over here in new Orleans for awhile.

    i am in Des Moines, Iowa.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.