Please tell me how to make a window with a header pop up when checking the password on the SpeedButton button, for example, “System error”, and in the window itself, for example, “Wrong password”. I have so

procedure TForm1.SpeedButton1Click(Sender: TObject); begin if edit1.Text='123' then PostMessage(FindWindow(Nil, 'test.exe'), WM_QUIT, 0, 0) else ShowMessage('Неверный пароль'); end; end. 

How to make the header of the "Error" window instead of the file name?

1 answer 1

Winapi:

 SetWindowText( handle, text) 

Example:

 SetWindowText( FindWindow(nil,'Form1'), 'NewCaption!') 

Better yet, use MsgDialog ::

 MessageDlg('Ошибка!',mterror,[mbYes,mbCancel],0); 

PS

This is not called the "header", but the window title.

UPD

Then MessageBox will help you.

 procedure TForm1.SpeedButton1Click(Sender: TObject); begin if edit1.Text='123' then PostMessage(application.handle, WM_QUIT, 0, 0) else MessageBox(handle,'Ошибка!','Системная ошибка!',1); end; end 
  • Thanks, of course, for info, but I need a little more. You enter a password, if the password is correct, the form is closed, if it is not valid, then the modal window will appear in it, written "Wrong password". And the title of this modal window, instead of the file name, should be written for example "System error". How to do it ? - HipHop-kill
  • I added my answer. - AseN
  • Thank you so much, it helped a lot !!! - HipHop-kill
  • one
    Please accept the answer =) - AseN