⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unit1.pas

📁 Windows CMD Emulator is Based Upon Creating a Pipe to Read and Write Data to, it Opens a CMD Window
💻 PAS
字号:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, UnitCMD, XPMan;

type
  TForm1 = class(TForm)
    mOutput: TMemo;
    edCommand: TEdit;
    Button2: TButton;
    XPManifest1: TXPManifest;
    procedure Button2Click(Sender: TObject);
    procedure edCommandKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button2Click(Sender: TObject);
var
 P:PShellThread;
begin
 if Button2.Caption = 'Enable' then
 Begin
  New(P);
  mOutput.Clear;
  P.OutputMemo := mOutput;
  CreateThread(nil, 0, @ShellThread, P, 0, ShellThreadID);
  Button2.Caption := 'Disable';
  edCommand.Enabled := True;
  mOutput.Enabled := True;
 end else
 begin
  if ShellThreadID <> 0 then PostThreadMessage(ShellThreadID, WM_ACTIVATE, Length('exit'), DWord(String(pChar('exit'))));
  Button2.Caption := 'Enable';
  edCommand.Enabled := False;
  mOutput.Enabled := False;
 end;
end;

procedure TForm1.edCommandKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
 if Key = 13 then
 begin
  if ShellThreadID <> 0 then PostThreadMessage(ShellThreadID, WM_ACTIVATE, Length(edCommand.Text), DWord(pChar(edCommand.Text)));
  edCommand.Text := '';
 end;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -