hidrau
asked on
I need a help working with applicationEventsMessage
Hello guys,
I would like to trigger a code after the user click ctrl + shift and WM_RBUTTONDOWN, but I am not getting any success. I need this help. Thanks
procedure TForm1.ApplicationEvents1M essage(var Msg: tagMSG; var Handled: Boolean);
begin
If (Msg.message = WM_RBUTTONDOWN) and (msg.message = ?????) Then showMessage('ok')
end;
I would like to trigger a code after the user click ctrl + shift and WM_RBUTTONDOWN, but I am not getting any success. I need this help. Thanks
procedure TForm1.ApplicationEvents1M
begin
If (Msg.message = WM_RBUTTONDOWN) and (msg.message = ?????) Then showMessage('ok')
end;
Forgot the FormKeyUp... PLease add this:
procedure TForm1.FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if Pressed then
Pressed:=False;
end;
procedure TForm1.FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if Pressed then
Pressed:=False;
end;
Sorry, my fault, somehow hadn't realized that you are using MessageEvents. :/
ASKER
I need to use in application because this must be in all application.
My application has more than 100 forms and it is impossible to place one for each form.
You see
My application has more than 100 forms and it is impossible to place one for each form.
You see
ok, I think it should be:
if (Msg.message = WM_RBUTTONDOWN) and (GetKeyState(VK_CONTROL) < 0) and (GetKeyState(VK_SHIFT) < 0) then
e.g.:
procedure TForm1.ApplicationEvents1M essage(var Msg: tagMSG;
var Handled: Boolean);
begin
if (Msg.message = WM_RBUTTONDOWN) and (GetKeyState(VK_CONTROL) < 0) and (GetKeyState(VK_SHIFT) < 0) then
ShowMessage('ok');
end;
And I meant ApplicationEvents of course :)
procedure TForm1.ApplicationEvents1M
var Handled: Boolean);
begin
if (Msg.message = WM_RBUTTONDOWN) and (GetKeyState(VK_CONTROL) < 0) and (GetKeyState(VK_SHIFT) < 0) then
ShowMessage('ok');
end;
And I meant ApplicationEvents of course :)
ASKER
I am gonna test
ASKER
If I need to include a key in this code, that is:
if ctrl + shift + z and WM_RBUTTONDOWN, what should I add?
Thanks
if ctrl + shift + z and WM_RBUTTONDOWN, what should I add?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank very much Tname
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
private
Pressed:Boolean;
procedure WMRButtonDown(var Message: TWMRButtonDown); message WM_RBUTTONDOWN;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.WMRButtonDown(var Message: TWMRButtonDown);
begin
if Pressed then begin
ShowMessage('OK');
Pressed:=False;
end;
end;
procedure TForm1.FormCreate(Sender:T
begin
Pressed:=False;
end;
procedure TForm1.FormKeyDown(Sender:
Shift: TShiftState);
begin
if (ssShift in Shift) and (ssCtrl in Shift) then
Pressed:=True;
end;
end.