?
Solved

Windows Handle Question

Posted on 2003-02-27
8
Medium Priority
?
144 Views
Last Modified: 2012-05-04
Hi guys,

I don´t now if it´s even possible to do this,but anyway...

I now how to get a handle to a specific window. But I always have to now the name of it, like 'Shell_TrayWnd' for the tasbar.
But first how do I now the names of other windows?
for example: Bevor I recieve my Mails in Outlook I set it up so that I always have to enter my password.

Is there a chance to get a handle to this "Password-Input-window" and to send my password-string from my app directly in to the password editfield?
How do I now the name of this window and how can I access this special edit field where the password belongs into?

I now its a little crazy example but anyway,just for understanding this window-handle-stuff

Thanks a lot
0
Comment
Question by:Scotchman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
8 Comments
 
LVL 5

Expert Comment

by:Lukasz Lach
ID: 8040557
Sure you can...
Have a look at my accepted answer on
http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20495095.html
You can make yourself a list of windows and child windows with that. Then simply Use FindWindow and FindWindowEx of which an example will you find on that page too :-)
0
 

Author Comment

by:Scotchman
ID: 8040922
I never worked with handles bevor,so am I right that a I can´t get a HANDLE only on windows but also on editboxes etc.?

If my understanding is right I use FindWindowEx to get a handle to window-CHILDS. Is a edit-box such a child,to?

I also found this:
(If I am right, EditWnd gets a handle to a edit-box,is that right???? )

function ChangeWndFirstEditText(Wnd: HWND; const Text: string): boolean;
var EditWnd: HWND;
begin
     Result:=False;
     EditWnd:=FindWindowEx(Wnd, 0, 'EDIT', nil);
     if EditWnd=0 then
          exit; // edit not found
     Result:=SendMessage(EditWnd, WM_SETTEXT, 0, Integer(PChar(Text)))<>0;
end;
0
 
LVL 1

Expert Comment

by:Wax0r
ID: 8041509
Hi,

Yes, the controls have handles as well, you can also for example get the handle of the Listview in the NT/XP/2k taskmanager if you wanted to.

I don't think that code is correct because if I remember correctly the 3rd parameter of FindWindowEx is a CLASS, and editboxes aren't of the 'edit' class variety i'm affraid :)

What you should do is get an API spy and hover it over that password dialog - the api spy will tell you what class that edit box is so that you can check for the appropriate class and return according results.

(E.g. it could be TEdit).

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Scotchman
ID: 8041542
API Spy, i never heard about that bevor,but sounds interesting. i will check it out...
0
 
LVL 1

Expert Comment

by:Wax0r
ID: 8041632
There's one that comes with Delphi  I think. Then there's one that comes with Visual Studio.. and there's quite a few of them available for free on the web as well;

http://www.matcode.com/apis32.htm
http://www.patorjk.com/progapispy.htm
http://www.programfiles.com/Default.asp?LinkId=8383
0
 

Author Comment

by:Scotchman
ID: 8055296
I used WinSight to listen for the window names, and it worked so far,but I still had no look getting the name of the Edit field. I also used ApiSpy,but it only gave me the names of the usable procedures or functions....
0
 

Author Comment

by:Scotchman
ID: 8055762
Got it now. But one last question:
In my case I have TWO windows with ne same class name which only differ in the window text.
Is there a chance to skip to the next window with the same class name if the first isn´t the right one?I can check this with the window name...
0
 
LVL 5

Accepted Solution

by:
Lukasz Lach earned 60 total points
ID: 8057385
second parameter in FindWindow is a Window Caption. When using EnumWindowProc use GetWindowText to get it's caption...
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses
Course of the Month8 days, 20 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question