- This topic has 12 replies, 5 voices, and was last updated 10 years ago by autopilot.
-
AuthorPosts
-
March 5, 2013 at 4:31 am #186584ChikeMember
I have just realized all the controls have control ID. There are duplicates but those I have seen are invisible which makes it easy.
Works on build 474, and should work on older and newer builds.Public Delegate Function EnumWChildindowaProc(ByVal Handle As IntPtr, ByRef Parameter As IntPtr) As Boolean Public Declare Auto Function EnumChildWindows Lib "User32.dll" _ (ByVal hwnd As IntPtr, ByVal Callback As EnumWChildindowaProc, ByRef lParam As IntPtr) As Boolean Declare Auto Function GetDlgCtrlID Lib "User32.dll" _ (ByVal hwnd As IntPtr) As Integer Public Function EnumFindID(ByVal hwnd As IntPtr, ByRef lParam As IntPtr) As Boolean If (GetDlgCtrlID(hwnd) = lParam) And IsWindowVisible(hwnd) Then lParam = hwnd Return False End If Return True End Function Sub main() Dim hwnd = FindWindow("DlgGroupChat Window Class", vbNullString) Dim ctl = &H6FD EnumChildWindows(hwnd, AddressOf EnumFindID, ctl) Console.WriteLine("user names: " & ctl.ToString("X8")) ctl = &HCA EnumChildWindows(hwnd, AddressOf EnumFindID, ctl) Console.WriteLine("room text: " & ctl.ToString("X8")) ctl = &HCB EnumChildWindows(hwnd, AddressOf EnumFindID, ctl) Console.WriteLine("user edit: " & ctl.ToString("X8")) End Sub
/edit: I have checked and it works on build 403
March 11, 2013 at 9:46 pm #186596autopilotMemberNice find and thanks for sharing!
March 11, 2013 at 10:33 pm #186595ChikeMemberI have always used EnumChildWindows to find romm text edit and user list, but by other properties not by control ID. The reason is probably that in WinspectorSpy I was using back then it wasn’t conspicuous as it is in WinSpy I have used now.
On a side note: If you don’t wish to use the lParam, the delegate can point to a non-shared method of a class and in that the reference to the class is passed. though it better be a class designed to this spesific task and not your form or application as using global variables is not a good practice.
April 16, 2013 at 9:57 am #186594ChiNaAdministratorThanks for sharing Chike!
July 10, 2013 at 6:12 pm #186593DepartureMember…………………………………………….
December 5, 2013 at 7:18 pm #186592ChiNaAdministrator@I missed this Part , Sorry about that Chike…
Since I am very new to Enum methods I have been on pinvoke.net for months learning about enumchild and enumproc. Right now I cant get the “users list” Win Handle from Window “ATL:00AD6190” with your Method Above. The ID’s that I am getting is not working with the function I am using.
So it means I will have to use the regular Window Handle ID of “ATL:00AD6190” Window on Build 545.
If I could get get some assistance figuring out how to get Child Window Handle ID’s of an Active Window Automatically could be awesome. thanks a lot in advance..December 5, 2013 at 10:11 pm #186591ChikeMember@ChiNa-Man wrote:
Right now I cant get the “users list” Win Handle from Window “ATL:00AD6190” with your Method Above. The ID’s that I am getting is not working with the function I am using.
What are you talking about?
Change your code as below and tell me ctl is not the exact same as the constant you returningPublic ReadOnly Property Status() As IntPtr Get Dim ctl As IntPtr = &H6FD EnumChildWindows(hwnd, AddressOf EnumFindID, ctl) Return 69282 'Win Handle End Get End Property
December 6, 2013 at 12:29 am #186590ChiNaAdministratorI did ALMOST the same, Now I know what I did wrong…. 🙁
I was using FindWindowEx and was looking for the “ATL:” Win Class, instead of using FindWindow and “DlgGroupChat Window Class”! Thanks Chike, It worked now….
March 1, 2014 at 12:44 am #186589cyberpunkMemberChike,
Does this work on the latest build? And before I waste your time trying to figure out what I might be doing wrong, does this code allow automatic enumeration of control handles (read Text, send Text, and userlist?) I recently updated Paltalk and naturally my program is having trouble accessing the userlist but has no issue accessing the Read Text and Send Text controls. I know I can run APISpy and get the new handle and edit my code, but I would like to offer my Mic Timer program for others to use real soon. So I decided now is the time to try and learn how to enumerate Windows and I stumbled on this thread. Obviously, if my program “breaks” everytime Paltalk is updated it will not be very useful to anyone but me.
March 1, 2014 at 5:05 am #186588ChikeMember@ManicMike wrote:
does this code allow automatic enumeration of control handles (read Text, send Text, and userlist?)
This is exactly what it does, and have been tested with latest paltalk back to even non-working versions (that force upgrade).
@ManicMike wrote:
I recently updated Paltalk and naturally my program is having trouble accessing the userlist
That is due privilige issues, pal runs under different account, make your program run as admin or highest available in manifest
March 2, 2014 at 2:42 am #186587cyberpunkMemberThis is exactly what it does, and have been tested with latest paltalk back to even non-working versions (that force upgrade).
Excellent, I just didn’t want to waste your time if I misunderstood what the code was supposed to do or if Paltalk had somehow prevented it from working. So that just leaves me clearly doing something wrong. To simplify things I have added your code to the declaration area of loco’s Admin Bot code that is available in this forum, then copied over code that builds a listbox of all the users names from my app and added it to the On Click event of a button. When I run the Admin bot the read text works just fine as does the send text, but I can’t get the list of users. Like I said I am intentionally not updating the ATL: xxxxxxx info that has changed from the update because it is my understanding this will no longer be necessary with your code. My question is should I have edited the NicListClass in some way ( it still has the previous ATL info from the last version I was using) or perhaps Remove the NicListClass entirely now? I doubt removal is the answer, and I realize doing that would require editing any place that NicListClass was called as well. I just have to assume I am not doing something that someone with more knowledge would intuitively know to do.
That is due privilige issues, pal runs under different account, make your program run as admin or highest available in manifest
I am running my app as Administrator. I suspect, the issue lies in my lack of understanding of exactly what goes on during this process. I mean I can see how we are supplying Class and Handle info but the truth is I am still not sure how it is all collected. I was hoping working with your code things would become more clear to me, but so much is clearly going on to find the Window information than I even imagined. How you guys figured this stuff out amazes me.
March 2, 2014 at 4:54 pm #186586ChikeMemberI’ve updated the bot code a while ago it should have these changes and AFAIK it works
March 2, 2014 at 8:29 pm #186585cyberpunkMemberOkay Chike, thanks anyway. I am using the latest version of code I have access to and I see what seems to be talk about you adding those corrections in that same thread I downloaded it from. i downloaded the ZIP file you offered to Johnny5 in this thread.
It is cool. I know how to make my timer work for me, was just hoping to upload the executable for others to use.
I appreciate you taking the time to respond. -
AuthorPosts
Related
- You must be logged in to reply to this topic.