Entering a Password in an Internet Explorer Window
I have a program that launches an Internet Explorer page as a QProcess and I need to pass two lines of login information plus a password.
I use QProcess process.setWorkingDirectory( "string",args);
process.start( "string");
etc.
I get the handle of the IE window and use the following subroutine to input to IE:
void TWOlogon::sendString( QByteArray string)
{
EnableWindow( hTWO, true);
int length = string.count()+1;
for( int i=0; i<length; i++)
{
keybd_event( string[i], 0,0,0);
keybd_event( string[i], 0, KEYEVENTF_KEYUP, 0);
}
}
This subroutine successfully passes the user login information, but when I try to input the password very strange behaviour takes place. Only two characters show on the password input screen and depending upon the password characters odd things happen to the IE screen such as expanding it to full screen, removing the favorites list, etc.
Any suggestions on what I'm doing wrong?
Re: Entering a Password in an Internet Explorer Window
I don't know, but you seem to be inputting as the last character string[string.count()], which might mess things up. (Why is length = string.count()+1);
Re: Entering a Password in an Internet Explorer Window
It's necessary to add 1 to length to account for the endl character. Without adding the 1, nothing prints on the line.
I've partially solved the problem of inputing the password. The above code successfully inputs user data such as ID and User Name, but fails while trying to input the password. I changed the code so the input looks like this for the password:
keybd_event( 0x31, 0,0,0);
keybd_event( 0x31, 0, KEYEVENTF_KEYUP, 0);
etc.
where 0x31 is the byte equivalent of the 1 character.
Not sure why the password input requires this, but it works. Now the problem is how to pack the series of 0x** characters into a QByteArray so I can pass this to the sendString subroutine.