中间件测试工具

中间件测试工具

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
object Form3: TForm3
  Left = 978
  Top = 563
  Width = 376
  Height = 110
  BorderIcons = [biSystemMenu]
  Caption = #27979#35797#24037#20855
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  object Label1: TLabel
    Left = 24
    Top = 16
    Width = 72
    Height = 13
    Caption = #23458#25143#31471#25968#37327#65306
  end
  object Label2: TLabel
    Left = 24
    Top = 48
    Width = 48
    Height = 13
    Caption = #31243#24207#21517#65306
  end
  object Edit1: TEdit
    Left = 112
    Top = 13
    Width = 65
    Height = 21
    TabOrder = 0
    Text = '1'
  end
  object Button1: TButton
    Left = 183
    Top = 11
    Width = 75
    Height = 25
    Caption = #24320#21551
    TabOrder = 1
    OnClick = Button1Click
  end
  object Button2: TButton
    Left = 272
    Top = 11
    Width = 75
    Height = 25
    Caption = #20851#38381#25152#26377
    TabOrder = 2
    OnClick = Button2Click
  end
  object Edit2: TEdit
    Left = 112
    Top = 40
    Width = 121
    Height = 21
    TabOrder = 3
    Text = 'd7client.exe'
  end
end

  

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
unit Unit3;
 
interface
 
uses
  Windows, Messages, SysUtils, Variants,
  Classes, Graphics,
  Controls, Forms, Dialogs, StdCtrls, Tlhelp32
  ;
 
type
  TForm3 = class(TForm)
    Label1: TLabel;
    Edit1: TEdit;
    Button1: TButton;
    Button2: TButton;
    Edit2: TEdit;
    Label2: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
 
var
  Form3: TForm3;
 
implementation
 
{$R *.dfm}
 
function EndProcess(ExeFileName: string): integer;
const
  PROCESS_TERMINATE = $0001;
var
  ContinueLoop: BOOLean;
  FSnapshotHandle: THandle;
  FProcessEntry32: TProcessEntry32;
begin
  Result := 0;
  FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
  FProcessEntry32.dwSize := SizeOf(FProcessEntry32);
  ContinueLoop := Process32First(FSnapshotHandle, FProcessEntry32);
 
  while integer(ContinueLoop) <> 0 do
  begin
    if ((UpperCase(ExtractFileName(FProcessEntry32.szExeFile))
      = UpperCase(ExeFileName)) or (UpperCase(FProcessEntry32.szExeFile)
      = UpperCase(ExeFileName))) then
      Result := integer(TerminateProcess(OpenProcess(PROCESS_TERMINATE, BOOL(0),
        FProcessEntry32.th32ProcessID), 0));
    ContinueLoop := Process32Next(FSnapshotHandle, FProcessEntry32);
  end;
  CloseHandle(FSnapshotHandle);
end;
 
procedure TForm3.Button1Click(Sender: TObject);
var
  i: integer;
  p: PAnsiChar;
begin
  p := PAnsiChar(Edit2.Text);
  for i := 1 to StrToIntDef(Edit1.Text, 0) do
    WinExec(p, SW_NORMAL)
end;
 
procedure TForm3.Button2Click(Sender: TObject);
begin
  EndProcess(Edit2.Text);
end;
 
end.

  

posted @   delphi中间件  阅读(1537)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
历史上的今天:
2018-08-01 QMsgPack的用法DEMO
2018-08-01 QMsgPack简介
2018-08-01 ClientDataSet的版本兼容性
2017-08-01 安卓读写INI文件
点击右上角即可分享
微信分享提示