我在自己的程序里定义了热键,为何在win2000和winxp中可以呼出,但在win98中却失灵,怎么也不行。为什么?

解决方案 »

  1.   

    interface
    uses k22;
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, ExtCtrls, StdCtrls, Menus;
    type
      TForm1 = class(TForm)
        PopupMenu1: TPopupMenu;
        N1: TMenuItem;
        X1: TMenuItem;
        procedure FormCreate(Sender: TObject);
        procedure HotKeyDown(var Msg: Tmessage); message WM_HOTKEY;
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;
      HotKeyId:Integer;
    implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
    begin
    form1.Hide;
    application.ShowMainForm:=false;
    HotKeyId:=GlobalAddAtom('MyHotKey');
    RegisterHotKey(Handle, hotkeyid, MOD_CONTROL, VK_F12);
    end;procedure TForm1.X1Click(Sender: TObject);
    begin
    AboutBox.showmodal;
    end;procedure TForm1.N1Click(Sender: TObject);
    begin
     UnRegisterHotKey(handle, HotKeyId);
            application.Terminate;
    end;procedure TForm1.HotKeyDown(var Msg: Tmessage);
    begin
    if (Msg.LparamLo = MOD_CONTROL) AND (Msg.LParamHi = VK_F12) then 
    begin
    Form1.PopupMenu1.Popup((screen.Width-form1.Width) div 2+250
      ,(screen.Height-form1.Height) div 2 );
    end;
    end;end.
      

  2.   

    楼主说错了吧,CTRL+F12在win98下应该是有用的,但在2000/xp下好像是不能用。原因不明,可能是系统保留了。