热键问题(100分)

  • 主题发起人 主题发起人 zhshj1963
  • 开始时间 开始时间
Z

zhshj1963

Unregistered / Unconfirmed
GUEST, unregistred user!
我在自己的程序里定义了热键,为何在win2000和winxp中可以呼出,但在win98中却失灵,怎么也不行。为什么?
 
把代码帖出来,大家帮忙分析分析<br>interface<br>uses k22;<br>uses<br>&nbsp; Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br>&nbsp; Dialogs, ExtCtrls, StdCtrls, Menus;<br>type<br>&nbsp; TForm1 = class(TForm)<br>&nbsp; &nbsp; PopupMenu1: TPopupMenu;<br>&nbsp; &nbsp; N1: TMenuItem;<br>&nbsp; &nbsp; X1: TMenuItem;<br>&nbsp; &nbsp; procedure FormCreate(Sender: TObject);<br>&nbsp; &nbsp; procedure HotKeyDown(var Msg: Tmessage); message WM_HOTKEY;<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; HotKeyId:Integer;<br><br><br>implementation<br><br>{$R *.dfm}<br><br><br><br>procedure TForm1.FormCreate(Sender: TObject);<br>begin<br>form1.Hide;<br>application.ShowMainForm:=false;<br>HotKeyId:=GlobalAddAtom('MyHotKey');<br>RegisterHotKey(Handle, hotkeyid, MOD_CONTROL, VK_F12);<br>end;<br><br>procedure TForm1.X1Click(Sender: TObject);<br>begin<br>AboutBox.showmodal;<br>end;<br><br>procedure TForm1.N1Click(Sender: TObject);<br>begin<br>&nbsp;UnRegisterHotKey(handle, HotKeyId);<br>&nbsp; &nbsp; &nbsp; &nbsp; application.Terminate;<br>end;<br><br>procedure TForm1.HotKeyDown(var Msg: Tmessage);<br>begin<br>if (Msg.LparamLo = MOD_CONTROL) AND (Msg.LParamHi = VK_F12) then <br>begin<br>Form1.PopupMenu1.Popup((screen.Width-form1.Width) div 2+250<br> &nbsp;,(screen.Height-form1.Height) div 2 );<br>end;<br>end;<br><br><br><br>end.
 
粗看一下,程序没有什么问题。你看看是不是你用的热键F12在WIN98下和其他的程序有冲突?
 
我在xp下注册F12热键都失败的,其它可以<br>难道是有冲突吗
 
后退
顶部