unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,ShellAPI, Menus, Appevnts, XPMan, ExtCtrls,
ComCtrls,DateUtils;
const
WM_TASKABAREVENT = WM_USER+1;
type
TForm2 =
class(TForm)
PopupMenu1: TPopupMenu;
disable1: TMenuItem;
enable1: TMenuItem;
close1: TMenuItem;
CheckBox1: TCheckBox;
Label1: TLabel;
Label2: TLabel;
Button1: TButton;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Label3: TLabel;
procedure Button1Click(Sender: TObject);
procedure close1Click(Sender: TObject);
procedure enable1Click(Sender: TObject);
procedure disable1Click(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
procedure TaskbarEvent(
var Msg: TMessage);
Message WM_TASKABAREVENT;
public
procedure WMSysCommand(
var Message: TWMSysCommand);
message WM_SYSCOMMAND;
end;
var
Form2: TForm2;
wnd:hwnd;
implementation
{$R *.dfm}
procedure delay(msec:longint);
var
start,stop:longint;
begin
start := gettickcount;
repeat
stop := gettickcount;
application.processmessages;
until (stop - start ) >= msec;
end;
procedure TForm2.WMSysCommand(
var Message: TWMSysCommand);
begin
if Message.CmdType
and $FFF0 = SC_MINIMIZE
then
begin
Hide;
end
else
inherited;
end;
procedure TForm2.TaskbarEvent(
var Msg: TMessage);
var Point : TPoint;
begin
case Msg.LParam
of
WM_LBUTTONDBLCLK:
begin
form2.show;
end;
WM_LBUTTONUP:
begin
form2.show;
end;
WM_RBUTTONUP:
begin
SetForegroundWindow(
Handle);
GetCursorPos(Point);
PopupMenu1.Popup(Point.x, Point.y);
end;
end;
end;
procedure TForm2.FormCreate(Sender: TObject);
var
NotifyIconData: TNotifyIconData;
begin
wnd := FindWindow(
nil,pchar(edit3.text));
Fillchar(NotifyIconData,Sizeof(NotifyIconData),0);
NotifyIconData.cbSize := Sizeof(NotifyIconData);
NotifyIconData.Wnd :=
Handle;
NotifyIconData.uFlags := NIF_MESSAGE
or NIF_ICON
or NIF_TIP;
NotifyIconData.uCallbackMessage := WM_TASKABAREVENT;
NotifyIconData.hIcon := Application.Icon.Handle;
NotifyIconData.szTip := '
AFK Buffer';
Shell_NotifyIcon(NIM_ADD, @NotifyIconData);
end;
procedure TForm2.FormDestroy(Sender: TObject);
var
NotifyIconData: TNotifyIconData;
begin
FillChar(NotifyIconData,Sizeof(NotifyIconData),0);
NotifyIconData.cbSize := Sizeof(NotifyIconData);
NotifyIconData.Wnd := Self.Handle;
NotifyIconData.uFlags := NIF_MESSAGE
or NIF_ICON
or NIF_TIP;
NotifyIconData.uCallbackMessage := WM_TASKABAREVENT;
NotifyIconData.hIcon := Application.Icon.Handle;
NotifyIconData.szTip := '
Punkt';
Shell_NotifyIcon(NIM_DELETE, @NotifyIconData);
end;
procedure TForm2.disable1Click(Sender: TObject);
begin
checkbox1.checked:=true;
end;
procedure TForm2.enable1Click(Sender: TObject);
begin
checkbox1.checked:=false;
button1.click;
end;
procedure TForm2.close1Click(Sender: TObject);
begin
form2.close;
end;
procedure TForm2.Button1Click(Sender: TObject);
var i,delay0r:integer;
begin
delay0r:= strtoint(edit1.Text);
wnd := FindWindow(
nil,pchar(edit3.Text));
if wnd=0
then begin
showmessage('
Client not found!');
exit;
end;
application.ProcessMessages;
PostMessage(wnd, WM_Keydown, VK_END, 0);
PostMessage(wnd, WM_Keyup, VK_END, 0);
sleep(50);
application.ProcessMessages;
PostMessage(wnd, WM_Keydown, $31, 0);
PostMessage(wnd, WM_Keyup, $31, 0);
sleep(delay0r);
application.ProcessMessages;
PostMessage(wnd, WM_Keydown, $32, 0);
PostMessage(wnd, WM_Keyup, $32, 0);
sleep(delay0r);
application.ProcessMessages;
PostMessage(wnd, WM_Keydown, $33, 0);
PostMessage(wnd, WM_Keyup, $33, 0);
sleep(delay0r);
application.ProcessMessages;
PostMessage(wnd, WM_Keydown, $34, 0);
PostMessage(wnd, WM_Keyup, $34, 0);
sleep(delay0r);
application.ProcessMessages;
PostMessage(wnd, WM_Keydown, $35, 0);
PostMessage(wnd, WM_Keyup, $35, 0);
sleep(50);
application.ProcessMessages;
PostMessage(wnd, WM_Keydown, VK_INSERT, 0);
PostMessage(wnd, WM_Keyup, VK_INSERT, 0);
//repeat
//delay(strtoint(edit2.text)*1000);
//buffen;
//until checkbox1.checked=true;
end;
end.