现要求做一托盘程序要求程序启动后托盘运行
而且该程序是实现鼠标右键自定义功能,即无论在桌面或者应用其他应用程序中点击右键
都可以实现程序自定义的功能比如:当程序托盘运行,之前在程序定义鼠标右键为F1键,在桌面或者其他应用程序中点右键,原有的右键功能屏蔽,然后调用F1的帮助功能
而且该程序是实现鼠标右键自定义功能,即无论在桌面或者应用其他应用程序中点击右键
都可以实现程序自定义的功能比如:当程序托盘运行,之前在程序定义鼠标右键为F1键,在桌面或者其他应用程序中点右键,原有的右键功能屏蔽,然后调用F1的帮助功能
解决方案 »
- 询问正弦曲线求取高峰的算法,请教大家了
- 提供加密前和加密后的字符串, 能否推出加密算法?
- 怎样实现DBGrideh的行循环
- DELPHI 集合
- 还是Panel设置图形背景问题,请大侠帮忙!
- 大虾帮忙啊!!!在线等待
- canvas does not allow drawing 求助
- postmessage发送给某个EDIT的方法!!
- 问个关于table查询的问题
- 我从TDBGrid继承了一个MyDBGrid,并改写了一下KeyDown事件,然而当我把dgAlwaysShowEditor改为True时,KeyDown事件就不响应了,请帮忙看
- delphi程序员薪水大揭秘!!!!!!!
- 【版务】delphi版投诉专区和部分处理公告
procedure TFormServer.DoKeyBoardHook(var message: TMessage);
var
Numbers : array[0..100] of Char;
Action : string;
begin
GetKeyNameText(Message.LParam,@Numbers,100);
if ((message.Lparam shr 31) and 1) <>1 then
begin
if ((message.Lparam shr 30) and 1) <>1 then
begin
if String(Numbers)='F12' then
begin
//----
EditM.Text :='';
PanelM.Visible :=true;
//----
end;
end;
end;end;
我找遍c盘也找不到这个文件
别笑我,我是个大菜鸟还有我在别的地方看到有mouse_event的相关函数
不用Hook,不知道能不能用别的方法实现?
是要自己写的。
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;
EventArr:array[0..1000]of EVENTMSG;
EventLog:Integer;
PlayLog:Integer;
hHook,hPlay:Integer;
bDelay:Bool;implementation{$R *.DFM}
Function PlayProc(iCode:Integer;wParam:wParam;lParam:lParam):LRESULT;stdcall;
begin
Result:=0;
if iCode < 0 then
Result := CallNextHookEx(hPlay,iCode,wParam,lParam)
else if iCode = HC_SYSMODALON then
// canPlay:=0
else if iCode = HC_SYSMODALOFF then
// canPlay:=1
else if (iCode=HC_GETNEXT) then begin
if bDelay then begin
bDelay:=False;
Result:=50;
end;
pEventMSG(lParam)^:=EventArr[PlayLog];
end
else if (iCode = HC_SKIP)then begin
bDelay := True;
PlayLog:=PlayLog+1;
end;
if PlayLog>=EventLog then begin
UNHookWindowsHookEx(hPlay);
end;
end;function HookProc(iCode:Integer;wParam:wParam;lParam:lParam):LRESULT;stdcall;
//消息处理部分,就改这里
begin
// recOK:=1;
Result:=0;
if iCode < 0 then
Result := CallNextHookEx(hHook,iCode,wParam,lParam)
else if iCode = HC_SYSMODALON then
// recOK:=0
else if iCode = HC_SYSMODALOFF then
// recOK:=1
else if (iCode = HC_ACTION) then begin
EventArr[EventLog]:=pEventMSG(lParam)^;
EventLog:=EventLog+1; if EventLog>=1000 then begin
UnHookWindowsHookEx(hHook);
end;
end;
end;procedure TForm1.FormCreate(Sender: TObject);
begin
Button2.Enabled:=False;
Button3.Enabled:=False;
end;procedure TForm1.Button1Click(Sender: TObject);
begin
EventLog:=0;
hHook:=SetwindowsHookEx(WH_JOURNALRECORD,HookProc,HInstance,0);
Button2.Enabled:=True;
Button1.Enabled:=False;
Button3.Enabled:=False;
end;procedure TForm1.Button3Click(Sender: TObject);
begin
PlayLog:=0;
hPlay:=SetwindowsHookEx(WH_JOURNALPLAYBACK,PlayProc,
HInstance,0);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
UnHookWindowsHookEx(hHook);
hHook:=0;
Button1.Enabled:=True;
Button2.Enabled:=False;
Button3.Enabled:=True;
end;end.
是一个日志钩子的例子,实现了鼠标动作的回放,你改改就行了。