如何禁用Ctrl+Alt+Shift组合键(100分)

  • 主题发起人 主题发起人 精灵魔
  • 开始时间 开始时间

精灵魔

Unregistered / Unconfirmed
GUEST, unregistred user!
unit Unit1;<br>interface<br>uses<br>Windows, Messages, Forms, Dialogs, Classes, Controls, StdCtrls;<br>type<br> &nbsp;TForm1 = class(TForm)<br> &nbsp;procedure FormCreate(Sender: TObject);<br> &nbsp;procedure FormClose(Sender: TObject; var Action: TCloseAction);<br> &nbsp;private<br> &nbsp; &nbsp;id1,id2: Integer;<br> &nbsp; &nbsp;procedure WMHotKey(var Msg : TWMHotKey); message WM_HOTKEY;<br>{ Privat-Declarations}<br> &nbsp;public<br>{ Public-Declarations}<br> &nbsp;end;<br>var<br> &nbsp;Form1 : TForm1;<br>implementation<br>{$R *.DFM}<br><br>procedure TForm1.WMHotKey (var Msg : TWMHotKey);<br>var<br> &nbsp;Wnd:HWND;<br>begin<br> &nbsp;if msg.HotKey = id1 then<br> &nbsp;begin<br> &nbsp; &nbsp;Wnd:=FindWindow('Notepad', &nbsp;nil); &nbsp; //这样会把记事本窗口给关闭了<br> &nbsp; &nbsp;PostMessage(Wnd,WM_CLOSE,0,0);<br> &nbsp;end;<br>end;<br><br>procedure TForm1.FormCreate(Sender: TObject);<br>Const<br> &nbsp;MOD_ALT = 1; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br> &nbsp;MOD_CONTROL = 2;<br> &nbsp;MOD_SHIFT = 4;<br>begin<br> &nbsp;Application.Title:='';<br> &nbsp;if GlobalFindAtom('MyHotkey1') = 0 then<br> &nbsp;begin<br> &nbsp; &nbsp;id1:=GlobalAddAtom('MyHotkey1');<br> &nbsp; &nbsp;RegisterHotKey(handle,id1,MOD_CONTROL+MOD_Alt+MOD_SHIFT,0);<br> &nbsp;end;<br>end;<br><br>{退出时释放全局热键}<br>procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);<br>begin<br> &nbsp;UnRegisterHotKey(handle,id1);<br> &nbsp;GlobalDeleteAtom(id1);<br>end;<br>end.<br>源程序如上,此代码只能在释放Ctrl+Alt+Shift时关闭记事本.那到底怎么修改才能按下Ctrl+Alt+Shift马上关闭记事本.
 
当你不需要让用户按Alt+Enter、Ctrl+Alt+Del、Ctrl+Esc等功能键的时候加入以下代码:<br><br>Var<br>temp:integer;<br>begin<br>SystemParametersInfo(Spi_screensaverrunning,1,@temp,0);<br>end;<br><br>当你要恢复功能键时用以下代码:<br><br>Var<br>Temp:integer;<br>begin<br>SystemParametersInfo(spi_screensaverrunning,0,@temp,0);<br>end;
 
Ctrl+Alt+Shift系统是没禁用这个组合键.
 
98可以的代码XP无效
 
要在2000或XP下怎么做呢
 

Similar threads

I
回复
0
查看
529
import
I
I
回复
0
查看
502
import
I
I
回复
0
查看
566
import
I
后退
顶部