设置热键,和使用都没什么问题了!
现在有个问题,
当按下键时候:
我要能够使整个应用程序激活,而且处于最大化的状态,有答案就结帖!
速度!在线等!
现在有个问题,
当按下键时候:
我要能够使整个应用程序激活,而且处于最大化的状态,有答案就结帖!
速度!在线等!
解决方案 »
- spcomm发送接收数据问题
- delphi下sql server 多关键字(用空格分开)查询,有点人工智能的意思了。
- 请教一个控件的问题
- 打开文件时如果输入的文件名不存在该怎么处理
- 【新手问题】delphi中消息弹出窗口的疑问
- 几种常用开发工具的比较(delphi得分很高,哈哈,意淫一把)
- 为什么我的程序在收到客户端的数据后在发送时会出错,请专家给我一个指点。
- 数据库及报表问题,请大家帮我一下
- 有关报表的问题?
- 由于特殊原因,需要把form 的borderStyle设为none ,但是没有了滚动条,如何再加上滚动条呢
- 疯了,fastreport 连接数据库问题
- delphi连接Access数据库,打开数据库后会有一个.ldb文件,类型会出现ACCESS等字样,如果你不想让人看出来怎么办?
详细去看。。
http://topic.csdn.net/t/20010417/11/98763.html
单元名称 : 系统热键、程序热键、程序隐藏示例单元
整 理 者 : LihuaSoft 2006-12-29
}{
热键一 : Alt + Shift + CapsLock 调出隐藏的程序主窗口
热键二 : Ctrl + Alt + F9 隐藏程序主窗口
热键三 : Alt + Shift + F10 打开一个提示框
}{
在windows中规定应用程序热键的唯一标识符取值范围在0x0000~0xBFFF之间,
动态链接库的取值范围在0xC000~0XFFFF之间。
热键的辅助按键还包括Mod_Ctrl,Mod_Alt和Mod_Shift,对于windows兼容键盘,
还包括windows标志键,Mod_Win。
热键设置成功后,在程序运行过程中如果有预定义的热键被按下,windows系统
都会给应用程序发送一个wm_hotkey消息。
}unit Unit_HotKeyDemo;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm_HotKeyDemo = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction); private
{ Private declarations } ID1,ID2,ID3: Integer; procedure WMHotKeyHandle(var Msg : TWMHotKey); message WM_HotKey; public
{ Public declarations }
end;var
Form_HotKeyDemo: TForm_HotKeyDemo;implementation{$R *.dfm}procedure WhenHotKey1Press;
begin
showmessage('你按下了 Alt + Shift + CapsLock 组合键,主窗体将显现');
application.ShowMainForm := true;
application.MainForm.Show;
Form_HotKeyDemo.WindowState := wsMaximized;
end;procedure WhenHotKey2Press;
begin
showmessage('你按下了 Ctrl + Alt + F9 组合键,主窗体将隐藏');
application.ShowMainForm := false;
application.MainForm.Hide;
end;procedure WhenHotKey3Press;
begin
showmessage('你按下了 Alt + Shift + F10 组合键');
end;procedure TForm_HotKeyDemo.WMHotKeyHandle(var Msg : TWMHotKey);
begin
msg.Result:=1;//该消息已经处理
if msg.HotKey = ID1 then WhenHotKey1Press;
if msg.HotKey = ID2 then WhenHotKey2Press;
if msg.HotKey = ID3 then WhenHotKey3Press;
end;procedure TForm_HotKeyDemo.FormCreate(Sender: TObject);
begin Font.Assign(Screen.MenuFont);
caption := '系统热键、程序热键、程序隐藏示例';
label1.Caption := '热键一 : Alt + Shift + CapsLock 调出隐藏的程序主窗口并最大化';
label2.Caption := '热键二 : Ctrl + Alt + F9 隐藏程序主窗口';
label3.Caption := '热键三 : Alt + Shift + F10 打开一个提示框'; { 注册 Alt + Shift + CapsLock 组合热键 }
if FindAtom('LihuaSoftHotKey1') = 0 then
begin
ID1:=GlobalAddAtom(pchar('LihuaSoftHotKey1'))-$C000;
RegisterHotkey(Handle,ID1,MOD_Alt or mod_Shift,$14);
end;
{ 注册 Ctrl + Alt + F9 组合热键 }
if FindAtom('LihuaSoftHotKey2') = 0 then
begin
ID2:=GlobalAddAtom(pchar('LihuaSoftHotKey2'))-$C000;
RegisterHotkey(Handle,ID2,MOD_Control or mod_Alt,VK_F9);
end;
{ 注册 Alt + Shift + F10 组合热键 }
if FindAtom('LihuaSoftHotKey3') = 0 then
begin
ID3:=GlobalAddAtom(pchar('LihuaSoftHotKey3'))-$C000;
RegisterHotkey(Handle,ID3,MOD_Alt or mod_Shift,VK_F10);
end;
end;procedure TForm_HotKeyDemo.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
{ 注销热键 }
if ID1 <> 0 then begin UnregisterHotKey(Handle,ID1); DeleteAtom(ID1); end;
if ID2 <> 0 then begin UnregisterHotKey(Handle,ID2); DeleteAtom(ID2); end;
if ID3 <> 0 then begin UnregisterHotKey(Handle,ID3); DeleteAtom(ID3); end;
end;end.