Code: Select all
const
// Приставка к сообщению в игре. Например, "WinAMP: Вася - Параша"
Header = 'WinAMP: ';
// Откидывать ли номер песни в строке винампа
ListCounter = true;
//*******************************************************************
type
PSShit = array [0..$FF] of char;
function FindWindow(ClassName, TitleText: PChar):HWND;
external '[email protected] stdcall';
function GetWindowText(Window: HWND; var Text: PSShit; Length: integer):integer;
external '[email protected] stdcall';
var
hWindow: HWND;
TitleText: PSShit;
s: string;
i: integer;
begin
hWindow:= FindWindow('Winamp v1.x', '');
if hWindow = 0 then exit;
if GetWindowText(hWindow, TitleText, $100) < 3 then exit;
if ListCounter then begin
while TitleText[i] <> '.' do begin
i:= i + 1;
if i > $FF then exit;
end;
i:= i + 2;
end;
while TitleText[i] <> #0 do begin
s:= s + TitleText[i];
i:= i + 1;
if i > $FF then break;
end;
s:= Header + Copy(s, 1, Length(s)-9);
UOSay(s);
end.