mtv_mlt.dpr Delphiソース(delphi5)

program mtv_mlt;

uses
  Forms,
  mtv_mltU in 'mtv_mltU.pas' {Form1};

{$R *.RES}

begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.

unit mtv_mltU;
interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ExtCtrls;

type
  TForm1 = class(TForm)
    Timer1: TTimer;
    procedure FormCreate(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
  private
    { Private 宣言 }
  public
    { Public 宣言 }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
var
  i,l: integer;
  s,s1,f: string;
  hMT,hmt1: hwnd;
begin
  i:=1;
  s1:='マイツール ビューア';
  f:='DISPATCH.EXE';
  l:=length(s1);
  setlength(s,30);

  hmt:=findwindow(nil,pchar(s1));
  if hmt>0 then
    begin
    getwindowtext(hmt, pchar(s), 25);
    setlength(s,l);
    repeat
      s1:=s+inttostr(i);inc(i);
      hmt1:=findwindow(nil,pchar(s1));
    until hmt1=0;
    setwindowtext(hmt, pchar(s1));

    winexec(pchar(f),1);
  end;
  timer1.enabled := true; 
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  close;
end;

end.