|
-
Aug 13th, 2007, 03:40 AM
#1
Thread Starter
Lively Member
FindWindowEx - Multiple controls with same class name
I'm trying to send text to a text box within another application, with the class name "Edit." Normally, this wouldn't be a problem, but there are 3 other boxes with the same class name in the same hwnd. How can I access them individually?
-
Aug 13th, 2007, 04:14 AM
#2
Re: FindWindowEx - Multiple controls with same class name
Did you try thease.
1. You can manupulate it windowRect for diffrence.
2. you can panipulate the text (GetWindowText) of the controlls for diffrents.
Last edited by Fazi; Aug 13th, 2007 at 04:23 AM.
-
Aug 13th, 2007, 04:24 AM
#3
Thread Starter
Lively Member
Re: FindWindowEx - Multiple controls with same class name
Yeah, that would tell me if the current box that I am accessing is the right or wrong one.. but if it's the wrong one, how do I tell my program to move on to the next?
-
Aug 13th, 2007, 04:29 AM
#4
Re: FindWindowEx - Multiple controls with same class name
neomulemi6,
You can rtrive the WindowRect & hwnd of all the controlls and store in an array(). then sort the arry. Within the array, you find the one you want. then reffer to its handle and do the rest.
-
Aug 13th, 2007, 04:31 AM
#5
Thread Starter
Lively Member
Re: FindWindowEx - Multiple controls with same class name
I'm not sure how to access a window by handle... only by class or title.
-
Aug 13th, 2007, 04:38 AM
#6
Re: FindWindowEx - Multiple controls with same class name
You can use the GetWindow API with the GW_HWNDNEXT argument constant or you can use the GetDlgCtrlID to retrieve the window control id number and match it with its known number to be able to identify if its the correct window.
.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Aug 13th, 2007, 04:44 AM
#7
Re: FindWindowEx - Multiple controls with same class name
 Originally Posted by neomulemi6
I'm not sure how to access a window by handle... only by class or title.
Most of the window related API have an argument like 'hWnd as long'.
hWnd is a long number that uniquly identifies a window by the OS. If you use FindWindowEx, the returned value is the handle of the window you find.
Last edited by Fazi; Aug 13th, 2007 at 04:52 AM.
-
Aug 13th, 2007, 05:04 AM
#8
Thread Starter
Lively Member
Re: FindWindowEx - Multiple controls with same class name
Isn't there a way to do this using the EnumWindows function, or something similar?
-
Aug 13th, 2007, 05:59 AM
#9
Re: FindWindowEx - Multiple controls with same class name
If you want to retrive a perticuler window, you can use FindWindow / FindWindowEx. (Please referrer to the MSDN For detail of earch.)
If you want to enumurate all the windows in the sysem, you can use EnumWindows and EnumChildWindows.
OK.
-
Aug 13th, 2007, 06:12 AM
#10
Re: FindWindowEx - Multiple controls with same class name
GetWindow with the GWL_HWNDNEXT is similar to enumerating hte windows but at the level that you have drilled down to. Check out my Find Window by Partial Window Caption for an example.
http://vbforums.com/showthread.php?t=316924
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|