as the subject say am trying to connect to server using this code in delphi

```
procedure TmainF.Button1Click(Sender: TObject);
var 
   rdp1 : TMsRdpClient7NotSafeForScripting ;
begin
  rdp1 := TMsRdpClient7NotSafeForScripting.Create(self);
  rdp1.Parent := mainF;
  rdp1.Server:=server_name;
  rdp1.UserName := user.Text;
  rdp1.AdvancedSettings7.ClearTextPassword := password.Text;
  rdp1.ConnectingText := 'connecting';
  rdp1.DisconnectedText := 'disconnected';
  rdp1.AdvancedSettings7.AuthenticationLevel:=0;
  rdp1.AdvancedSettings7.EnableCredSspSupport:=true;
  rdp1.Connect;
end;

```

the code is working fine but if the user entered a wrong user name or password  

the rdp object is showing the remote desktop login prompt box to reenter the user name or password like the image

[![enter image description here](https://i.stack.imgur.com/6afw8.jpg)](https://i.stack.imgur.com/6afw8.jpg)

I want to validate the username and password before connect  

or prevent this box and show a custom message from my app

I tried to use OnLogonError() procedure but it's not fired any code  

and I read this [Question](https://stackoverflow.com/questions/37669589/prevent-failed-logon-attempt-window-after-failing-to-supply-proper-credentials-t) but the code is c# and I confused with .getocx() and I can't find (PromptForCredentials) in (MSTSCLib\_TLB.pas)

any help :( ??

sorry for my bad English.