What's the signature of message method?
What's the signature of message method?
I want to hook WMActivate using Delphi detours library.
But this cannot compile:
var
TrampolineTFormWMActivate: procedure(var Message: TWMActivate);
message WM_ACTIVATE;
I want to hook WMActivate using Delphi detours library.
But this cannot compile:
var
TrampolineTFormWMActivate: procedure(var Message: TWMActivate);
message WM_ACTIVATE;
var
ReplyDeleteTrampolineTFormWMActivate: procedure(var Msg: TWMActivate) of object;
Here is an example :
ReplyDelete//--------------------------------------
uses DDetours;
type
TTrampolineWMActivate = procedure(Control: TControl; var Message: TWMActivate);
TCustomFormHack = type TCustomForm;
var
TrampolineWMActivate: TTrampolineWMActivate = nil;
procedure WMActivateHook(Control: TControl; var Message: TWMActivate);
const
Bit2Bool: array [Boolean] of string = ('False', 'True');
begin
Main.Caption := Format('WMActivate(%s).Active=%s', [Control.Name, Bit2Bool[Message.Active <> WA_INACTIVE]]);
TrampolineWMActivate(Control, Message);
end;
procedure TMain.FormCreate(Sender: TObject);
begin
@TrampolineWMActivate := InterceptCreate(@TCustomFormHack.WMActivate, @WMActivateHook);
end;
Mahdi Safsafi Thanks! Useful example
ReplyDelete