win2000下如何禁止鼠标右键?(100分)

  • 主题发起人 主题发起人 dkzl
  • 开始时间 开始时间
D

dkzl

Unregistered / Unconfirmed
GUEST, unregistred user!
win2000下如何禁止鼠标右键?
 
是用程序还是在2K下设置呀
 
在程序里<br>我在程序里用了一个ActiveX控件,鼠标右键点击这个控件时会出现控件带的菜单<br>我想把这个菜单屏蔽掉<br>我在98下已经做到了,用钩子<br>但在2000不行
 
Hook在2000下也可以的呀,为什么不行?<br>{<br>&nbsp; demonstrate a mouse hook in a form.<br>}<br>unit Unit1;<br><br>interface<br><br>uses<br>&nbsp; Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,<br>&nbsp; StdCtrls;<br><br>type<br>&nbsp; TForm1 = class(TForm)<br>&nbsp; &nbsp; Edit1: TEdit;<br>&nbsp; &nbsp; procedure FormCreate(Sender: TObject);<br>&nbsp; private<br>&nbsp; &nbsp; { Private declarations }<br>&nbsp; public<br>&nbsp; &nbsp; { Public declarations }<br>&nbsp; end;<br><br>var<br>&nbsp; Form1: TForm1;<br>&nbsp; FMHook: HHOOK;<br>&nbsp; function FMHookProc(Code: Integer; WParam: Longint; var Msg: TMsg): Longint; stdcall;<br><br>implementation<br><br>{$R *.DFM}<br><br>function FMHookProc(Code: Integer; WParam: Longint; var Msg: TMsg): Longint; stdcall;<br>begin <br>&nbsp; &nbsp;if Msg.Message = WM_RBUTTONDOWN then<br>&nbsp; &nbsp;with form1 do<br>&nbsp; &nbsp;begin<br>&nbsp; &nbsp; &nbsp; //你还可以先判断一下位置。<br>&nbsp; &nbsp; &nbsp; Msg.Message := 0;<br>&nbsp; &nbsp;end ; <br>&nbsp; &nbsp;Result := CallNextHookEx(FMHook, Code, WParam, Longint(@Msg)); //放出消息给下一个.<br>end;<br><br>procedure TForm1.FormCreate(Sender: TObject);<br>begin<br>&nbsp; FMHook := SetWindowsHookEx(WH_GETMESSAGE, @FMHookProc, 0, GetCurrentThreadID);<br>end;<br><br>end.<br>
 
to zw84611:试了你的代码!很好!谢谢你!
 
谢谢zw84611<br>可能是我在98下的Hook代码在2000下不能用吧<br>用你提供的代码就成功了<br>再次感谢!!!!
 

Similar threads

S
回复
0
查看
768
SUNSTONE的Delphi笔记
S
S
回复
0
查看
681
SUNSTONE的Delphi笔记
S
S
回复
0
查看
816
SUNSTONE的Delphi笔记
S
S
回复
0
查看
733
SUNSTONE的Delphi笔记
S
后退
顶部