with dlgDebug do begin//Debug 信息
TimeLine;
re.SelAttributes.Color := selColor;
re.paragraph.FirstIndent := indent;
re.Lines.Add(intToStr(theMsg));
//mm.Lines.Add(intToStr(theMsg));
end;
end;
procedure deb(const theStr: string; const Args: array of const); overload;
begin
if not dbg then exit;
with dlgDebug do begin//Debug 信息
TimeLine;
re.SelAttributes.Color := selColor;
re.paragraph.FirstIndent := indent;
re.Lines.Add(format(theStr, Args));
//mm.Lines.Add(format(theStr, Args));
end;
end;
procedure TdlgDebug.TimeLine;
begin with re do begin
paragraph.FirstIndent := 0;
SelAttributes.Color := clRed;
lines.Add(formatDateTime(LongTimeFormat, now));
end; end;
procedure TdlgDebug.FormCreate(Sender: TObject);
begin
indent := 10;
selColor := clYellow;
end;
end.
//▓▓▓▓▓▓▓▓▓ HookPrj.dpr
library HookPrj;
uses
SysUtils,
Classes,
Hook_U in 'Hook_U.pas';
exports
EnableWheelHook ,
DisableWheelHook;
begin
end.
//▓▓▓▓▓▓▓▓▓ Hook_U.pas
unit Hook_U; interface
uses Windows,Messages, SysUtils, dialogs;
var HK: HHOOK;//钩子的句柄值
hFocus: HWnd;
buf: array [0..1024] of char;
sTitle: string;
iC: byte;
zDelta: short;
function WheelHookProc(Code: Integer; WParam: Longint; Msg: Longint): LRESULT; stdcall;
function EnableWheelHook : Boolean; stdcall; export;
function DisableWheelHook: Boolean; stdcall; export;
implementation
//██████████████████████████████████▌处理钩子
function WheelHookProc(Code: Integer; WParam: Longint;Msg:Longint): LRESULT; stdcall;
begin
zDelta := short(HiWord(PMsg(Msg)^.wParam));
if (Code=HC_ACTION) and (PMsg(Msg)^.Message=WM_MOUSEWHEEL) and (abs(zDelta)>200) then begin
hFocus := GetForegroundWindow;
GetWindowText(hFocus, buf, 1024);
sTitle := string(buf);
if ( pos('mplayerc', sTitle)>0 )or( pos('Media Player Classic', sTitle)>0 ) then begin
inc(iC);
//按一次蓝色侧键产生两条消息,二合一处理的话相当于快进1次,即5秒,
//都处理的话相当于快进2次,即10秒
//if (iC mod 2)=0 then begin
keybd_event(VK_Control, MapVirtualKey(VK_Control, 0), 0, 0); //CTRL Down