DELPHI盒子
!实时搜索: 盒子论坛 | 注册用户 | 修改信息 | 退出
检举帖 | 全文检索 | 关闭广告 | 捐赠
技术论坛
 用户名
 密  码
自动登陆(30天有效)
忘了密码
≡技术区≡
DELPHI技术
lazarus/fpc/Free Pascal
移动应用开发
Web应用开发
数据库专区
报表专区
网络通讯
开源项目
论坛精华贴
≡发布区≡
发布代码
发布控件
文档资料
经典工具
≡事务区≡
网站意见
盒子之家
招聘应聘
信息交换
论坛信息
最新加入: namnvh
今日帖子: 0
在线用户: 2
导航: 论坛 -> DELPHI技术 斑竹:liumazi,sephil  
作者:
男 sy0116 (sy0116) ★☆☆☆☆ -
盒子活跃会员
2004/1/22 21:19:22
标题:
再问热键 浏览:1165
加入我的收藏
楼主: 用以下代码实现热键功能,但这样程序只能响应一个热键,要怎样修改才能让他能响应连个或多个热键呢
const
   WM_SNAPHOTKEY=WM_USER + 101;
private
    { Private declarations }
    procedure ONHotkey(var message:Tmessage);message WM_HOTKEY;

procedure TForm1.ONHotkey(var message:Tmessage);
begin
     if  (message.WParam=WM_SNAPHOTKEY) then
        begin
          showmessage('ok');
        end;

end;
procedure TForm1.FormShow(Sender: TObject);
begin
RegisterHotKey(Handle,WM_SNAPHOTKEY,MOD_CONTROL,VK_F8 );
end;
----------------------------------------------
-
作者:
男 bios (阿贡) ★☆☆☆☆ -
盒子中级会员
2004/1/23 16:47:06
1楼: const
  //--------------------系统热键消息------------------------------
   Hot_FromClip= WM_USER + 101;//来自剪贴板
   Hot_Screen=WM_USER + 102;  //全屏
   Hot_Control= WM_USER + 103;//截控件
   Hot_Rectangle=WM_USER + 104;// 矩形
   Hot_RoundRect=WM_USER + 105;//圆角矩形
   Hot_Round=WM_USER + 106;//圆形
   Hot_Triangle=WM_USER + 107;//三角形
   Hot_Polygon=WM_USER + 108;//多边形
   Hot_Timer=WM_USER + 109;//定时
   Hot_Remote=WM_USER + 110;//远程
   Hot_Active=WM_USER + 111;//活动窗口
   Hot_Scroll=WM_USER + 112;//滚动截图

 //--------------------------------------------------------
procedure TMainForm.DealHotKey;
begin

   RegisterHotKey(Handle,Hot_Screen,0,VK_SNAPSHOT  );//print screen要单独注册不能更改

   MyRegisterKey(CutPasteFromClipStr,Hot_FromClip);
   MyRegisterKey(CutControlStr, Hot_Control);
   MyRegisterKey(CutRectangleStr,Hot_Rectangle);
   MyRegisterKey(CutRoundRectStr,Hot_RoundRect);
   MyRegisterKey(CutRoundStr , Hot_Round );
   MyRegisterKey(CutTriangleStr, Hot_Triangle);
   MyRegisterKey(CutPolygonStr,Hot_Polygon );
   MyRegisterKey(CutTimerStr, Hot_Timer );
   MyRegisterKey(CutRemoteStr,Hot_Remote);
   MyRegisterKey(CutActiveStr,Hot_Active);
   MyRegisterKey(CutScrollStr,Hot_Scroll );

end;

procedure TMainForm.MyUnRegisterKey;
begin
  UnregisterHotKey(Handle,Hot_Screen);
  UnregisterHotKey(Handle,Hot_FromClip);
  UnregisterHotKey(Handle,Hot_Control);
  UnregisterHotKey(Handle,Hot_Rectangle);
  UnregisterHotKey(Handle,Hot_RoundRect);
  UnregisterHotKey(Handle,Hot_Round );
  UnregisterHotKey(Handle,Hot_Triangle);
  UnregisterHotKey(Handle,Hot_Polygon );
  UnregisterHotKey(Handle, Hot_Timer );
  UnregisterHotKey(Handle, Hot_Remote);
  UnregisterHotKey(Handle, Hot_Active);
  UnregisterHotKey(Handle, Hot_Scroll );
end;

----------------------------------------------
按此在新窗口浏览图片
按此在新窗口浏览图片
信息
登陆以后才能回复
Copyright © 2CCC.Com 盒子论坛 v3.0.1 版权所有 页面执行70.3125毫秒 RSS