如题

解决方案 »

  1.   

    在onkeypress事件中判断呀
    if key=char(#13) then....//好久不用D了,可能写的不对,你测试一下
      

  2.   

    如果要在任何时候判断,那就是给窗体设置快劫键了,参考我的旧东西
    例子中响应的是ctrl+alt+shift+F11和F7
     private
            { Private declarations }
        aatom:atom;
        aatom2:atom;
        procedure hotkey(var msg:tmessage);message wm_hotkey;


    。在form.create事件中写
      //注册热键
       aatom:=globaladdatom('hot key');
      aatom2:=globaladdatom('hot key2');
      RegisterHotKey(handle,aatom,mod_control+MOD_ALT+mod_shift,vk_f12);
      RegisterHotKey(handle,aatom2,mod_control+MOD_ALT+mod_shift,vk_f7);响应事件
    procedure TForm1.hotkey(var msg:tmessage);
    begin
      if (msg.LParamHi=VK_F12) and (msg.LParamLo=mod_control+MOD_ALT+mod_shift) then
        if panel1.Visible then
         begin
          panel1.Visible:=false;
          end
         else
         begin
          panel1.Visible:=true;
          end;     if (msg.LParamHi=VK_F7) and (msg.LParamLo=mod_control+MOD_ALT+mod_shift) then
        
        if tabsheet4.Showing then
         begin
          tabsheet1.Show;
          end
         else
         begin
          tabsheet4.Show;
          end;
    end;
      

  3.   

    请参考超级猛料关于键盘Hook的资料http://lysoft.lz169.com/Kingron/wjjsoft_366.html
      

  4.   

    多谢各位大哥支持,我是这样写的,可是还是不行...if key = char(#13) then
      button1Click(application);烦请高手再指点一下,小弟不胜感激!
      

  5.   


      if key=chr(vk_return) then button1.Click;
      

  6.   

    晕,还是不行,是不是要在USES 里加什么东西啊?
      

  7.   

    如果把if key=chr(vk_return) then button1.Click;这句放到能获得焦点的控件(例如Edit)的OnKeyPress事件就可以。