[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ProgSoc] GUI expect
Hey gleNN,
> What I want is the same idea for a Windows GUI, where I'm expecting, say
> a login window, and I can automatically type in a username/password and
> have it log in. Anyone know how this is done?
There isn't really an easy way to achieve exactly what you're after, there
are products like Rational Robot which do something like it. However it's
much more reliable (though annoyingly tedious) to write code that uses
the Windows User Interface SDK functions to manipulate the windows, ie.:
- Use EnumWindows() to find the dialog window that contains the
logon you want to maipulate based on it's caption and class name
- Use EnumChildWindows() to find the text windows for the username
and password
- Use SendMessage() with the WM_CHAR message to fill in the text
you need into the text boxes
- Use EnumChildWindows() to find the Ok button window
- Use GetDlgCtrlId() to get the control id of the button window
- Use SendMessage() with the WM_COMMAND message, the button window
control id and the dialog window handle to click the button.
The advantage of the later approach is that the window can be
active/non-active and be rearranged and located anywhere on the screen and
the code should still work. John should be able to tell you all the nitty
critty (I sent him some sample code to do this sort of thing ages ago).
Cheers,
Shaun
-
You are subscribed to the progsoc mailing list. To unsubscribe, send a
message containing "unsubscribe" to progsoc-request@nospam.progsoc.uts.edu.au.
If you are having trouble, ask owner-progsoc@nospam.progsoc.uts.edu.au for help.