SA-MP/exgui/Rcon.pas

66 lines
1.3 KiB
ObjectPascal
Raw Normal View History

2023-11-07 23:38:36 +08:00
unit Rcon;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TfmRcon = class(TForm)
2023-12-02 20:35:55 +08:00
edInput: TEdit;
moOutput: TMemo;
2023-12-02 19:57:04 +08:00
procedure FormClose(Sender: TObject; var Action: TCloseAction);
2023-12-16 23:27:29 +08:00
procedure edInputKeyPress(Sender: TObject; var Key: Char);
2023-12-02 19:57:04 +08:00
procedure FormShow(Sender: TObject);
2023-11-07 23:38:36 +08:00
private
{ Private declarations }
public
2023-12-16 23:27:29 +08:00
Host: String;
Password: String;
protected
procedure CreateParams(var Params: TCreateParams); override;
2023-11-07 23:38:36 +08:00
end;
var
fmRcon: TfmRcon;
implementation
{$R *.dfm}
2023-12-16 23:27:29 +08:00
procedure Output(szOutput: PChar); stdcall;
begin
fmRcon.moOutput.Lines.Add(szOutput);
end;
procedure TfmRcon.CreateParams(var Params: TCreateParams);
2023-12-02 19:57:04 +08:00
begin
2023-12-16 23:27:29 +08:00
inherited CreateParams(Params);
Params.ExStyle:= Params.ExStyle or WS_EX_APPWINDOW;
Params.WndParent:= GetDesktopWindow;
2023-12-02 19:57:04 +08:00
end;
procedure TfmRcon.FormClose(Sender: TObject; var Action: TCloseAction);
begin
2023-12-16 23:27:29 +08:00
Destroy;
end;
procedure TfmRcon.edInputKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then begin
if edInput.Text <> '' then begin
moOutput.Lines.Add('> ' + edInput.Text);
edInput.Text:= '';
end;
Key:= #0;
end;
2023-12-02 19:57:04 +08:00
end;
procedure TfmRcon.FormShow(Sender: TObject);
begin
2023-12-16 23:27:29 +08:00
Caption:= 'Remote Console - ' + Host;
2023-12-02 19:57:04 +08:00
end;
2023-11-07 23:38:36 +08:00
end.