比如,像FPE那样的用小键盘的“*”。

解决方案 »

  1.   

    转贴: 
    全局热键 
     吴中卫  通常在自己的程序里定义热键,只能在自己的应用窗口范围内使用,未免使用起来受到一定的限制。 
    如果能在自己的应用程序里定义能被所有窗口访问的热键,应该是比较具有现实意义的。要定义一个全局热键,通常有三个步骤: 
      1。定义 Windows 的消息 WM_HOTKEY 的 HOOK 链,即 procedure myshortcut(var message: TMessage); message WM_HOTKEY;   
     2。向 Windows 加入一个全局原子 hotkey : GlobalAddAtom(’hotkey’), 并保留其句柄    
    3。向 Windows 登记热键链: RegisterHotKey( 应用句柄,全局原子句柄, mod_control ,88 ); 其中,RegisterHotKey 函数原形如下 
    BOOL RegisterHotKey( 
                HWND hWnd, // 连接热键的窗口句柄 
    int id, // 全局原子句柄 
    UINT fsModifiers,      // 热键修饰标志 
    UINT vk // 虚拟键盘码 );  
      这里,fsModifiers 是指虚拟键盘码 vk 结合何种键一起生成 WM_HOTKEY 的消息,它是下列三值的组合:    
      MOD_ALT      // ALT 键必须按下 
    MOD_CONTROL  // CTRL 键必须按下 
    MOD_SHIFT    // SHIFT 键必须按下 
      有了这些准备,你就可以定义自己喜欢的方式了。 
    下面是一个范例,当 CTRL + Q 在任何时候被按下时,都会打出 “你好,Crtl + Q 被按下” 的信息。 
    type 
      TForm1 = class(TForm) 
        procedure FormCreate(Sender: TObject); 
        procedure FormDestroy(Sender: TObject);   protected 
        procedure myshortcut(var message: TMessage); message WM_HOTKEY; 
      private 
        { Private-Deklarationen } 
      public 
        { Public-Deklarationen } 
      end; var 
      Form1: TForm1; 
      id:Integer; implementation {$R *.DFM} procedure TForm1.myshortcut(var message: TMessage); 
    begin 
      ShowMessage(’你好,Crtl + Q 被按下’); 
    end; procedure TForm1.FormCreate(Sender: TObject); 
    begin 
    id:=GlobalAddAtom(’hotkey’); 
      RegisterHotKey(handle,id,mod_control,88); 
    end; procedure TForm1.FormDestroy(Sender: TObject); 
    begin 
    UnRegisterHotKey(handle,id); //别忘了在退出时取消定义 
    end;
      

  2.   

    RegisterHotKey:(from win32 sdk help)BOOL RegisterHotKey(    HWND hWnd, // window to receive hot-key notification
        int id, // identifier of hot key
        UINT fsModifiers, // key-modifier flags
        UINT vk  // virtual-key code
       );
     ParametershWndIdentifies the window that will receive WM_HOTKEY messages generated by the hot key. If this parameter is NULL, WM_HOTKEY messages are posted to the message queue of the calling thread and must be processed in the message loop. idSpecifies the identifier of the hot key. No other hot key in the calling thread should have the same identifier. An application must specify a value in the range 0x0000 through 0xBFFF. A shared dynamic-link library (DLL) must specify a value in the range 0xC000 through 0xFFFF (the range returned by the GlobalAddAtom function). To avoid conflicts with hot-key identifiers defined by other shared DLLs, a DLL should use the GlobalAddAtom function to obtain the hot-key identifier. fsModifiersSpecifies keys that must be pressed in combination with the key specified by the nVirtKey parameter in order to generate the WM_HOTKEY message. The fsModifiers parameter can be a combination of the following values: Value Meaning
    MOD_ALT Either ALT key must be held down.
    MOD_CONTROL Either CTRL key must be held down.
    MOD_SHIFT Either SHIFT key must be held down.
     vkSpecifies the virtual-key code of the hot key.  Return ValuesIf the function succeeds, the return value is nonzero.
    If the function fails, the return value is zero. ResWhen a key is pressed, the system looks for a match against all thread hot keys. Upon finding a match, the system posts the WM_HOTKEY message to the message queue of the thread that registered the hot key. This message is posted to the beginning of the queue so it is removed by the next iteration of the message loop. 
    This function cannot associate a hot key with a window created by another thread. 
    RegisterHotKey fails if the keystrokes specified for the hot key have already been registered by another hot key. If the window identified by the hWnd parameter already registered a hot key with the same identifier as that specified by the id parameter, the new values for the fsModifiers and vk parameters replace the previously specified values for these parameters.
      

  3.   

    直接在Initialization中使用RegisterHotKey就可以了!
      

  4.   

    同意, cbdiy(暂无)  我就是这样实现公司的系统............
      

  5.   

    var
      id1,id2:integer;  id1:=GlobalAddAtom('HotKey');
      registerHotKey(handle,id1,MOD_CONTROL,83);
      id2:=GlobalAddAtom('HotKey2');
      registerHotKey(handle,id2,MOD_CONTROL,72);  UnRegisterHotKey(handle,id1);
      UnRegisterHotKey(handle,id2);procedure HotKey(var msg:Tmessage);message WM_HotKey;procedure TForm1.HotKey(var msg: Tmessage);
    var
      key:char;
    begin
      key:='p';
      if (msg.LParamLo=MOD_CONTROL) and (msg.LParamHi=83) then
      begin
        form1.FormKeyPress(self,key); 
        form1.show;
      end;
      if (msg.LParamLo=MOD_CONTROL) and (msg.LParamHi=72) then
      begin
        form1.hide;
      end;
    end;