- This topic has 3 replies, 3 voices, and was last updated 12 years ago by
String.
-
AuthorPosts
-
March 17, 2011 at 8:12 pm #187078
autopilot
MemberA 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.
March 18, 2011 at 1:20 am #187081String
MemberHandy and helpful, well done.
March 20, 2011 at 3:27 am #187080Departure
MemberNice 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.
March 22, 2011 at 12:13 pm #187079autopilot
MemberGreat to hear from you Dep!
@Departure wrote:I’m over here in new Orleans for awhile.
i am in Des Moines, Iowa.
-
AuthorPosts
- You must be logged in to reply to this topic.