Snip3rX
asked on
How to login to a website using delphi?
Hello, I am trying to login to my site CPanel using a delphi program,
Well its a long story, here is the conclusion:
i want program to login to my site cpanel, and click some place to ask the website to make a backup for the site , after that using the same program to download the backup.
its looks hard but here is the details:
i am using TWebbrowser
WebBrowser1.Navigate('http://www.mysite.com:2082');
Will popup a security window ask username and a password,
i want to make my prgram fill the 2 edit with the username and password
and check the Remember my credentials
and last Click on the OK button, Ā thats it :)
and if its possible we make all this stuff without showing this Window?!
Any help?
Well its a long story, here is the conclusion:
i want program to login to my site cpanel, and click some place to ask the website to make a backup for the site , after that using the same program to download the backup.
its looks hard but here is the details:
i am using TWebbrowser
WebBrowser1.Navigate('http://www.mysite.com:2082');
Will popup a security window ask username and a password,
i want to make my prgram fill the 2 edit with the username and password
and check the Remember my credentials
and last Click on the OK button, Ā thats it :)
and if its possible we make all this stuff without showing this Window?!
Any help?
function FindWindowByTitle(WindowTitle: string): Hwnd;
var
NextHandle: Hwnd;
NextTitle: array[0..260] of char;
begin
// Get the first window
NextHandle := GetWindow(Application.Handle, GW_HWNDFIRST);
while NextHandle > 0 do
begin
// retrieve its text
GetWindowText(NextHandle, NextTitle, 255);
if Pos(WindowTitle, StrPas(NextTitle)) <> 0 then
begin
Result := NextHandle;
Exit;
end
else
// Get the next window
NextHandle := GetWindow(NextHandle, GW_HWNDNEXT);
end;
Result := 0;
end;
procedure TForm1.Timer2Timer(Sender: TObject);
var
hIExplorer: HWND;
begin
hIExplorer := FindWindowByTitle('Windows Security');
if hIExplorer <> 0 then
begin
// SendMessage(hIExplorer, WM_SYSCOMMAND, SC_CLOSE, 0);
// WHAT I NEED I THINK ITS GOES HERE
end;
end;
Login-Window.jpg
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.