Простенький Авто-нажатие F1-f12

  • Автор темы Автор темы Lomanu4
  • Дата начала Дата начала

Lomanu4

Команда форума
Администратор
Ofline
с способностью авто-нажатие F1-F12 грузить игру по указному пути.
Сохранять/загружать настроек программы.
Мини описание :
Запускаем программу наводим курсор на активное окно игры жмем клавишу 1 цифру один на клавиатуре производим настройки программы и уходи гулять.
Среда программирования Lazarus:
[HIDE=5]
Код:
unit Unit1;

{$mode objfpc}{$H+}

interface

uses
  Spin, process, Windows, Forms, Grids, SysUtils, lcltype, ExtCtrls, StdCtrls,
  IniPropStorage, Dialogs, Menus, Buttons, PopupNotifier, Classes;

type

  { TForm1 }

  TForm1 = class(TForm)
    BitBtn1: TBitBtn;
    Button1: TButton;
    Button2: TButton;
    CheckBox1: TCheckBox;
    Edit1: TEdit;
    Edit3: TEdit;
    GroupBox1: TGroupBox;
    GroupBox2: TGroupBox;
    GroupBox3: TGroupBox;
    GroupBox4: TGroupBox;
    GroupBox6: TGroupBox;
    GroupBox7: TGroupBox;
    Image1: TImage;
    Image2: TImage;
    IniPropStorage1: TIniPropStorage;
    MainMenu1: TMainMenu;
    MenuItem1: TMenuItem;
    MenuItem12: TMenuItem;
    MenuItem13: TMenuItem;
    MenuItem14: TMenuItem;
    MenuItem15: TMenuItem;
    MenuItem16: TMenuItem;
    MenuItem18: TMenuItem;
    MenuItem19: TMenuItem;
    MenuItem2: TMenuItem;
    MenuItem20: TMenuItem;
    MenuItem3: TMenuItem;
    MenuItem4: TMenuItem;
    MenuItem5: TMenuItem;
    MenuItem6: TMenuItem;
    MenuItem7: TMenuItem;
    OpenDialog1: TOpenDialog;
    OpenDialog2: TOpenDialog;
    Panel1: TPanel;
    Panel2: TPanel;
    PopupNotifier1: TPopupNotifier;
    Process1: TProcess;
    SaveDialog1: TSaveDialog;
    SpinEdit1: TSpinEdit;
    StringGrid1: TStringGrid;
    Timer1: TTimer;
    Timer10: TTimer;
    Timer11: TTimer;
    Timer12: TTimer;
    Timer13: TTimer;
    Timer14: TTimer;
    Timer15: TTimer;
    Timer2: TTimer;
    Timer3: TTimer;
    Timer4: TTimer;
    Timer5: TTimer;
    Timer6: TTimer;
    Timer7: TTimer;
    Timer8: TTimer;
    Timer9: TTimer;
    ToggleBox1: TToggleBox;
    ToggleBox4: TToggleBox;



    procedure BitBtn1Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure CheckBox1Click(Sender: TObject);
    procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
    procedure FormCreate(Sender: TObject);
    procedure FormKeyPress(Sender: TObject; var Key: char);


    procedure MenuItem15Click(Sender: TObject);

    procedure MenuItem18Click(Sender: TObject);
    procedure MenuItem2Click(Sender: TObject);
    procedure MenuItem4Click(Sender: TObject);
    procedure MenuItem5Click(Sender: TObject);
    procedure MenuItem6Click(Sender: TObject);
    procedure MenuItem7Click(Sender: TObject);


    procedure Timer10Timer(Sender: TObject);
    procedure Timer11Timer(Sender: TObject);
    procedure Timer12Timer(Sender: TObject);
    procedure Timer13Timer(Sender: TObject);
    procedure Timer14Timer(Sender: TObject);
    procedure Timer15Timer(Sender: TObject);

    procedure Timer1Timer(Sender: TObject);
    procedure Timer2Timer(Sender: TObject);
    procedure Timer3Timer(Sender: TObject);
    procedure Timer4Timer(Sender: TObject);
    procedure Timer5Timer(Sender: TObject);
    procedure Timer6Timer(Sender: TObject);
    procedure Timer7Timer(Sender: TObject);
    procedure Timer8Timer(Sender: TObject);
    procedure Timer9Timer(Sender: TObject);
    procedure ToggleBox1Change(Sender: TObject);

    procedure ToggleBox4Change(Sender: TObject);




  private
    procedure ShowHwndAndClassName(CrPos: TPoint);
    { private declarations }
  public
    { public declarations }
  end;

var
  Form1: TForm1;
  L2Wnd: THandle;
  l2r: HWND;

implementation

{$R *.lfm}

{ TForm1 }

// Показать окно игры
procedure TForm1.ToggleBox1Change(Sender: TObject);
begin
  SetForegroundWindow(L2Wnd);
  begin
    sleep(500);
    SetForegroundWindow(Form1.HANDLE);

  end;
end;



// Кнопка подключить/отключить окно
procedure TForm1.ToggleBox4Change(Sender: TObject);
begin
  if Timer1.Enabled = False then
    Timer1.Enabled := True
  else
    Timer1.Enabled := False;
end;




// Заполнить сталбци при запуске
procedure TForm1.FormCreate(Sender: TObject);
begin
  StringGrid1.Cells[0, 1] := 'F1';
  StringGrid1.Cells[0, 2] := 'F2';
  StringGrid1.Cells[0, 3] := 'F3';
  StringGrid1.Cells[0, 4] := 'F4';
  StringGrid1.Cells[0, 5] := 'F5';
  StringGrid1.Cells[0, 6] := 'F6';
  StringGrid1.Cells[0, 7] := 'F7';
  StringGrid1.Cells[0, 8] := 'F8';
  StringGrid1.Cells[0, 9] := 'F9';
  StringGrid1.Cells[0, 10] := 'F10';
  StringGrid1.Cells[0, 11] := 'F11';
  StringGrid1.Cells[0, 12] := 'F12';

  StringGrid1.Cells[1, 1] := '0';
  StringGrid1.Cells[1, 2] := '0';
  StringGrid1.Cells[1, 3] := '0';
  StringGrid1.Cells[1, 4] := '0';
  StringGrid1.Cells[1, 5] := '0';
  StringGrid1.Cells[1, 6] := '0';
  StringGrid1.Cells[1, 7] := '0';
  StringGrid1.Cells[1, 8] := '0';
  StringGrid1.Cells[1, 9] := '0';
  StringGrid1.Cells[1, 10] := '0';
  StringGrid1.Cells[1, 11] := '0';
  StringGrid1.Cells[1, 12] := '0';
end;
           // снять отметить все чекбоксы
procedure TForm1.CheckBox1Click(Sender: TObject);
begin
  if CheckBox1.Checked = True then
  begin
    StringGrid1.Cells[3, 1] := '1';
    StringGrid1.Cells[3, 2] := '1';
    StringGrid1.Cells[3, 3] := '1';
    StringGrid1.Cells[3, 4] := '1';
    StringGrid1.Cells[3, 5] := '1';
    StringGrid1.Cells[3, 6] := '1';
    StringGrid1.Cells[3, 7] := '1';
    StringGrid1.Cells[3, 8] := '1';
    StringGrid1.Cells[3, 9] := '1';
    StringGrid1.Cells[3, 10] := '1';
    StringGrid1.Cells[3, 11] := '1';
    StringGrid1.Cells[3, 12] := '1';
  end

  else
  begin
    StringGrid1.Cells[3, 1] := '0';
    StringGrid1.Cells[3, 2] := '0';
    StringGrid1.Cells[3, 3] := '0';
    StringGrid1.Cells[3, 4] := '0';
    StringGrid1.Cells[3, 5] := '0';
    StringGrid1.Cells[3, 6] := '0';
    StringGrid1.Cells[3, 7] := '0';
    StringGrid1.Cells[3, 8] := '0';
    StringGrid1.Cells[3, 9] := '0';
    StringGrid1.Cells[3, 10] := '0';
    StringGrid1.Cells[3, 11] := '0';
    StringGrid1.Cells[3, 12] := '0';
  end;
end;
//Запустить кучу окон
procedure TForm1.Button1Click(Sender: TObject);
var
  i: integer; {объявляем переменную типа Integer}
begin
  i := 0;
  {организовываем цикл с условием выполнения пока i не будет равно 100}
  repeat
    begin
      {при каждом выполнении переменная i будет увеличиваться на 1}
      i := i + 1;
      Process1.CommandLine := Edit3.Text;
      Process1.Execute;
    end;
  until i = StrToInt(SpinEdit1.Text);

end;

// Старт скрипта
procedure TForm1.BitBtn1Click(Sender: TObject);
var
  ms, sec, min, hr: integer;
begin
  l2r := FindWindow(PChar(Edit1.Text), nil);

  ms := 10;
  sec := 1000;
  min := 60000;
  hr := 3600000;

  if BitBtn1.Caption = 'Пуск..' then
  begin
    Image1.Picture.LoadFromFile('resources/stop.png');
    BitBtn1.Glyph := Image1.Picture.Bitmap;
    BitBtn1.Caption := 'Стоп..';
     Image2.Picture.LoadFromFile('resources/green.png');
    MenuItem7.Bitmap := Image2.Picture.Bitmap;

    if StringGrid1.Cells[2, 1] = 'Миллисекунды' then
      Timer2.Interval := StrToInt(StringGrid1.Cells[1, 1]) * ms;
    if StringGrid1.Cells[2, 1] = 'Секунды' then
      Timer2.Interval := StrToInt(StringGrid1.Cells[1, 1]) * sec;
    if StringGrid1.Cells[2, 1] = 'Минуты' then
      Timer2.Interval := StrToInt(StringGrid1.Cells[1, 1]) * min;
    if StringGrid1.Cells[2, 1] = 'Часы' then
      Timer2.Interval := StrToInt(StringGrid1.Cells[1, 1]) * hr;
        begin

        end;

    if StringGrid1.Cells[2, 2] = 'Миллисекунды' then
      Timer3.Interval := StrToInt(StringGrid1.Cells[1, 2]) * ms;
    if StringGrid1.Cells[2, 2] = 'Секунды' then
      Timer3.Interval := StrToInt(StringGrid1.Cells[1, 2]) * sec;
    if StringGrid1.Cells[2, 2] = 'Минуты' then
      Timer3.Interval := StrToInt(StringGrid1.Cells[1, 2]) * min;
    if StringGrid1.Cells[2, 2] = 'Часы' then
      Timer3.Interval := StrToInt(StringGrid1.Cells[1, 2]) * hr;
      begin

      end;

    if StringGrid1.Cells[2, 3] = 'Миллисекунды' then
      Timer4.Interval := StrToInt(StringGrid1.Cells[1, 3]) * ms;
    if StringGrid1.Cells[2, 3] = 'Секунды' then
      Timer4.Interval := StrToInt(StringGrid1.Cells[1, 3]) * sec;
    if StringGrid1.Cells[2, 3] = 'Минуты' then
      Timer4.Interval := StrToInt(StringGrid1.Cells[1, 3]) * min;
    if StringGrid1.Cells[2, 3] = 'Часы' then
      Timer4.Interval := StrToInt(StringGrid1.Cells[1, 3]) * hr;
        begin

        end;

    if StringGrid1.Cells[2, 4] = 'Миллисекунды' then
      Timer5.Interval := StrToInt(StringGrid1.Cells[1, 4]) * ms;
    if StringGrid1.Cells[2, 4] = 'Секунды' then
      Timer5.Interval := StrToInt(StringGrid1.Cells[1, 4]) * sec;
    if StringGrid1.Cells[2, 4] = 'Минуты' then
      Timer5.Interval := StrToInt(StringGrid1.Cells[1, 4]) * min;
    if StringGrid1.Cells[2, 4] = 'Часы' then
      Timer5.Interval := StrToInt(StringGrid1.Cells[1, 4]) * hr;
        begin

        end;

    if StringGrid1.Cells[2, 5] = 'Миллисекунды' then
      Timer6.Interval := StrToInt(StringGrid1.Cells[1, 5]) * ms;
    if StringGrid1.Cells[2, 5] = 'Секунды' then
      Timer6.Interval := StrToInt(StringGrid1.Cells[1, 5]) * sec;
    if StringGrid1.Cells[2, 5] = 'Минуты' then
      Timer6.Interval := StrToInt(StringGrid1.Cells[1, 5]) * min;
    if StringGrid1.Cells[2, 5] = 'Часы' then
      Timer6.Interval := StrToInt(StringGrid1.Cells[1, 5]) * hr;
        begin

        end;

    if StringGrid1.Cells[2, 6] = 'Миллисекунды' then
      Timer7.Interval := StrToInt(StringGrid1.Cells[1, 6]) * ms;
    if StringGrid1.Cells[2, 6] = 'Секунды' then
      Timer7.Interval := StrToInt(StringGrid1.Cells[1, 6]) * sec;
    if StringGrid1.Cells[2, 6] = 'Минуты' then
      Timer7.Interval := StrToInt(StringGrid1.Cells[1, 6]) * min;
    if StringGrid1.Cells[2, 6] = 'Часы' then
      Timer7.Interval := StrToInt(StringGrid1.Cells[1, 6]) * hr;
       begin

       end;

    if StringGrid1.Cells[2, 7] = 'Миллисекунды' then
      Timer8.Interval := StrToInt(StringGrid1.Cells[1, 7]) * ms;
    if StringGrid1.Cells[2, 7] = 'Секунды' then
      Timer8.Interval := StrToInt(StringGrid1.Cells[1, 7]) * sec;
    if StringGrid1.Cells[2, 7] = 'Минуты' then
      Timer8.Interval := StrToInt(StringGrid1.Cells[1, 7]) * min;
    if StringGrid1.Cells[2, 7] = 'Часы' then
      Timer8.Interval := StrToInt(StringGrid1.Cells[1, 7]) * hr;
       begin

       end;

    if StringGrid1.Cells[2, 8] = 'Миллисекунды' then
      Timer9.Interval := StrToInt(StringGrid1.Cells[1, 8]) * ms;
    if StringGrid1.Cells[2, 8] = 'Секунды' then
      Timer9.Interval := StrToInt(StringGrid1.Cells[1, 8]) * sec;
    if StringGrid1.Cells[2, 8] = 'Минуты' then
      Timer9.Interval := StrToInt(StringGrid1.Cells[1, 8]) * min;
    if StringGrid1.Cells[2, 8] = 'Часы' then
      Timer9.Interval := StrToInt(StringGrid1.Cells[1, 8]) * hr;
        begin

        end;

    if StringGrid1.Cells[2, 9] = 'Миллисекунды' then
      Timer10.Interval := StrToInt(StringGrid1.Cells[1, 9]) * ms;
    if StringGrid1.Cells[2, 9] = 'Секунды' then
      Timer10.Interval := StrToInt(StringGrid1.Cells[1, 9]) * sec;
    if StringGrid1.Cells[2, 9] = 'Минуты' then
      Timer10.Interval := StrToInt(StringGrid1.Cells[1, 9]) * min;
    if StringGrid1.Cells[2, 9] = 'Часы' then
      Timer10.Interval := StrToInt(StringGrid1.Cells[1, 9]) * hr;
        begin

        end;

    if StringGrid1.Cells[2, 10] = 'Миллисекунды' then
      Timer11.Interval := StrToInt(StringGrid1.Cells[1, 10]) * ms;
    if StringGrid1.Cells[2, 10] = 'Секунды' then
      Timer11.Interval := StrToInt(StringGrid1.Cells[1, 10]) * sec;
    if StringGrid1.Cells[2, 10] = 'Минуты' then
      Timer11.Interval := StrToInt(StringGrid1.Cells[1, 10]) * min;
    if StringGrid1.Cells[2, 10] = 'Часы' then
      Timer11.Interval := StrToInt(StringGrid1.Cells[1, 10]) * hr;
       begin

       end;

    if StringGrid1.Cells[2, 11] = 'Миллисекунды' then
      Timer12.Interval := StrToInt(StringGrid1.Cells[1, 11]) * ms;
    if StringGrid1.Cells[2, 11] = 'Секунды' then
      Timer12.Interval := StrToInt(StringGrid1.Cells[1, 11]) * sec;
    if StringGrid1.Cells[2, 11] = 'Минуты' then
      Timer12.Interval := StrToInt(StringGrid1.Cells[1, 11]) * min;
    if StringGrid1.Cells[2, 11] = 'Часы' then
      Timer12.Interval := StrToInt(StringGrid1.Cells[1, 11]) * hr;
        begin

        end;

    if StringGrid1.Cells[2, 12] = 'Миллисекунды' then
      Timer13.Interval := StrToInt(StringGrid1.Cells[1, 12]) * ms;
    if StringGrid1.Cells[2, 12] = 'Секунды' then
      Timer13.Interval := StrToInt(StringGrid1.Cells[1, 12]) * sec;
    if StringGrid1.Cells[2, 12] = 'Минуты' then
      Timer13.Interval := StrToInt(StringGrid1.Cells[1, 12]) * min;
    if StringGrid1.Cells[2, 12] = 'Часы' then
      Timer13.Interval := StrToInt(StringGrid1.Cells[1, 12]) * hr;
       begin

       end;

    timer2.Enabled := true;
    timer3.Enabled := true;
    timer4.Enabled := true;
    timer5.Enabled := true;
    timer6.Enabled := true;
    timer7.Enabled := true;
    timer8.Enabled := true;
    timer9.Enabled := true;
    timer10.Enabled := true;
    timer11.Enabled := true;
    timer12.Enabled := true;
    timer13.Enabled := true;
  end
  else
  begin
    Image1.Picture.LoadFromFile('resources/play.png');
    BitBtn1.Glyph := Image1.Picture.Bitmap;
    BitBtn1.Caption := 'Пуск..';
    Image2.Picture.LoadFromFile('resources/red.png');
    MenuItem7.Bitmap := Image2.Picture.Bitmap;
    timer2.Enabled := False;
    timer3.Enabled := False;
    timer4.Enabled := False;
    timer5.Enabled := False;
    timer6.Enabled := False;
    timer7.Enabled := False;
    timer8.Enabled := False;
    timer9.Enabled := False;
    timer10.Enabled := False;
    timer11.Enabled := False;
    timer12.Enabled := False;
    timer13.Enabled := False;
  end;

end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  if OpenDialog1.Execute then
    Edit3.Text := OpenDialog1.FileName;
end;


// Если нажата кнопка закрыть программу
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: boolean);
begin
  CanClose := Application.MessageBox(
    PChar('Вы действительно хотите выйти из  программы ?'), 'Внимание !', MB_YesNo) = id_Yes;
end;

//ShowMessage('Включен');
// Если нажата клавиша 1 стоп таймер
procedure TForm1.FormKeyPress(Sender: TObject; var Key: char);
begin
  if ToggleBox4.Caption = 'Новое' then
    exit
  else
  if Key = '1' then
  begin
    Timer1.Enabled := False;
    Application.Messagebox('Окно успешно подключено!',
      PChar(Edit1.Text), mb_ok);
    ToggleBox4.Caption := 'Новое';

  end;
end;



procedure TForm1.MenuItem15Click(Sender: TObject);
begin
  Close;
end;


//Вывод подсказки
procedure TForm1.MenuItem18Click(Sender: TObject);
begin
  if timer1.Enabled = True then
    PopupNotifier1.Text :=
      'Наведите курсор на окно игры и нажмите клавишу  1 (цифру один на клавиатуре).';

  if timer1.Enabled = False then
    PopupNotifier1.Text := 'В данный момент подключено окно '
      + Edit1.Text +
      ' если это то окно, что вы хотели подключить - настройте время выстовите галочки напротив и нажмите кнопку Пуск.';
  PopupNotifier1.Show;

  begin
    SetForegroundWindow(Form1.Handle);

  end;
end;

// Открыть настройки для игры
procedure TForm1.MenuItem2Click(Sender: TObject);
begin
  if OpenDialog1.Execute then
  begin
    StringGrid1.SaveOptions :=  [soDesign, soContent, soAttributes];
    StringGrid1.LoadFromFile(OpenDialog1.FileName);
    Form1.Caption := ExtractFileName(OpenDialog1.FileName);
    StringGrid1.Columns.Items[0].Title.Alignment:=StringGrid1.Columns.Items[0].Title.Alignment.taCenter;
     StringGrid1.Columns.Items[1].Title.Alignment:=StringGrid1.Columns.Items[1].Title.Alignment.taCenter;;
     StringGrid1.Columns.Items[2].Title.Alignment:=StringGrid1.Columns.Items[2].Title.Alignment.taCenter;;
     StringGrid1.Columns.Items[3].Title.Alignment:=StringGrid1.Columns.Items[3].Title.Alignment.taCenter;;

    Image1.Picture.LoadFromFile('resources/play.png');
    BitBtn1.Glyph := Image1.Picture.Bitmap;
    BitBtn1.Caption := 'Пуск..';
    timer2.Enabled := False;
    timer3.Enabled := False;
    timer4.Enabled := False;
    timer5.Enabled := False;
    timer6.Enabled := False;
    timer7.Enabled := False;
    timer8.Enabled := False;
    timer9.Enabled := False;
    timer10.Enabled := False;
    timer11.Enabled := False;
    timer12.Enabled := False;
    timer13.Enabled := False;
  end
  else
    exit;

end;

procedure TForm1.MenuItem4Click(Sender: TObject);
begin
  ShowMessage('Воспользуйтесь кнопкой подсказка...');
end;

procedure TForm1.MenuItem5Click(Sender: TObject);
begin
  ShowMessage('Автор : "BIT"'+#13#10+'Среда разработки: "Lazarus"');// #13#10
end;

// Сохраняем настройки в файл
procedure TForm1.MenuItem6Click(Sender: TObject);
begin
  if SaveDialog1.Execute then
  begin
    StringGrid1.SaveOptions :=  [soDesign, soContent];

    StringGrid1.SaveToFile(SaveDialog1.FileName);

  end
  else
    exit;

end;

procedure TForm1.MenuItem7Click(Sender: TObject);
begin
    if Timer1.Enabled = False then
  begin
    ShowMessage('Подключено окно: ' + Edit1.Text + #13#10+ #13#10+ 'Путь к файлу: '+ Edit3.Text );
    end
    else
    begin
     ShowMessage('Пока нет информации.');
    end;

end;

// Обработка настроек и отправка клавишь в окно
procedure TForm1.Timer2Timer(Sender: TObject);
begin

  if (StringGrid1.Cells[3, 1] = '1') and (StringGrid1.Cells[0, 1] = 'F1') then

    PostMessage(l2r, WM_KEYDOWN, VK_f1, 0);
end;

procedure TForm1.Timer3Timer(Sender: TObject);
begin
  if (StringGrid1.Cells[3, 2] = '1') and (StringGrid1.Cells[0, 2] = 'F2') then

    PostMessage(l2r, WM_KEYDOWN, VK_f2, 0);
end;

procedure TForm1.Timer4Timer(Sender: TObject);
begin
  if (StringGrid1.Cells[3, 3] = '1') and (StringGrid1.Cells[0, 3] = 'F3') then

    PostMessage(l2r, WM_KEYDOWN, VK_f3, 0);
end;

procedure TForm1.Timer5Timer(Sender: TObject);
begin
  if (StringGrid1.Cells[3, 4] = '1') and (StringGrid1.Cells[0, 4] = 'F4') then

    PostMessage(l2r, WM_KEYDOWN, VK_f4, 0);
end;

procedure TForm1.Timer6Timer(Sender: TObject);
begin
  if (StringGrid1.Cells[3, 5] = '1') and (StringGrid1.Cells[0, 5] = 'F5') then

    PostMessage(l2r, WM_KEYDOWN, VK_f5, 0);
end;

procedure TForm1.Timer7Timer(Sender: TObject);
begin
  if (StringGrid1.Cells[3, 6] = '1') and (StringGrid1.Cells[0, 6] = 'F6') then

    PostMessage(l2r, WM_KEYDOWN, VK_f6, 0);
end;

procedure TForm1.Timer8Timer(Sender: TObject);
begin
  if (StringGrid1.Cells[3, 7] = '1') and (StringGrid1.Cells[0, 7] = 'F7') then

    PostMessage(l2r, WM_KEYDOWN, VK_f7, 0);
end;

procedure TForm1.Timer9Timer(Sender: TObject);
begin
  if (StringGrid1.Cells[3, 8] = '1') and (StringGrid1.Cells[0, 8] = 'F8') then

    PostMessage(l2r, WM_KEYDOWN, VK_f8, 0);
end;

procedure TForm1.Timer10Timer(Sender: TObject);
begin
  if (StringGrid1.Cells[3, 9] = '1') and (StringGrid1.Cells[0, 9] = 'F9') then

    PostMessage(l2r, WM_KEYDOWN, VK_f9, 0);
end;

procedure TForm1.Timer11Timer(Sender: TObject);
begin
  if (StringGrid1.Cells[3, 10] = '1') and (StringGrid1.Cells[0, 10] = 'F10') then

    PostMessage(l2r, WM_KEYDOWN, VK_f10, 0);
end;

procedure TForm1.Timer12Timer(Sender: TObject);
begin
  if (StringGrid1.Cells[3, 11] = '1') and (StringGrid1.Cells[0, 11] = 'F11') then

    PostMessage(l2r, WM_KEYDOWN, VK_f11, 0);
end;

procedure TForm1.Timer13Timer(Sender: TObject);
begin
  if (StringGrid1.Cells[3, 12] = '1') and (StringGrid1.Cells[0, 12] = 'F12') then

    PostMessage(l2r, WM_KEYDOWN, VK_f12, 0);
end;

procedure TForm1.Timer14Timer(Sender: TObject);
begin
      Image2.Picture.LoadFromFile('resources/red.png');
    MenuItem7.Bitmap := Image1.Picture.Bitmap;

end;

procedure TForm1.Timer15Timer(Sender: TObject);
begin
     Image2.Picture.LoadFromFile('resources/green.png');
    MenuItem7.Bitmap := Image1.Picture.Bitmap;
end;


// Поиск окна под мышкой
procedure TForm1.Timer1Timer(Sender: TObject);
var
  rPos: TPoint;
begin
  if boolean(GetCursorPos(rPos)) then
    ShowHwndAndClassName(rPos);
  ToggleBox4.Caption := 'Переподключить';

end;

// Поиск окна под мышкой
procedure TForm1.ShowHwndAndClassName(CrPos: TPoint);
var
  aName: array [0..255] of char;
begin
  L2Wnd := WindowFromPoint(CrPos);
  if boolean(GetClassName(L2Wnd, aName, 256)) then
    edit1.Text := string(aName)

  else;

end;

end.
[/HIDE]
Кодинг by BIT Hack
 

Вложения

Назад
Сверху Снизу