给你一段别人的程序参考:
unit MainForm;interfaceuses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  KsHooks, KsForms, EpIIForms, StdCtrls, KsControls, KsButtons,
  EpIIButtons, ComCtrls, FileCtrl,menus,shellapi;type
  TForm1 = class(TForm)
    EpForm1: TEpForm;
    DriveComboBox1: TDriveComboBox;
    DirectoryListBox1: TDirectoryListBox;
    FileListBox1: TFileListBox;
    ListView1: TListView;
    HotKey1: THotKey;
    EpButton1: TEpButton;
    RadioButton1: TRadioButton;
    EpButton2: TEpButton;
    procedure FormCreate(Sender: TObject);
    procedure RadioButton1Click(Sender: TObject);
    procedure EpButton1Click(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure EpButton2Click(Sender: TObject);
    procedure ListView1SelectItem(Sender: TObject; Item: TListItem;
      Selected: Boolean);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
  public
    { Public declarations }  procedure WMhotkeyhandle(var msg:Tmessage);
       message wm_hotkey; //响应敏感键按键消息  end;var
  Form1: TForm1;
  hotkeyid :array[1..50] of integer;  //热键的Id
  i:integer=0;                        //热键的序号
  KeyMod:array[1..50] of integer;     //热键要素
  TheShiftState:TShiftState;
  KeyValue:array[1..50] of Word;      //热键值
  ExeAction:array[1..50] of String;    //执行路径名
  HotKey:Array[1..50] of TShortCut;    //热键
  NowItemIndex:integer;                  //当前listview的Item的序号
  DeleteNumber:array[1..50] of integer; //删除的热键的序号
  E:Array[1..50] of integer=($c1000,$c1001,$c1002,$c1003,$c1004,$c1005,
                       $c1006,$c1007,$c1008,$c1009,$c1010,$c1011,$c1012,
                       $c1013,$c1014,$c1015,$c1016,$c1017,$c1018,$c1019,
                       $c1020,$c1021,$c1022,$c1023,$c1024,$c1025,$c1026,
                       $c1027,$c1028,$c1029,$c1030,$c1031,$c1032,$c1033,
                       $c1034,$c1035,$c1036,$c1037,$c1038,$c1039,$c1040,
                       $c1041,$c1042,$c1043,$c1044,$c1045,$c1046,$c1047,
                       $c1048,$c1049);  //定义50个热键
implementation{$R *.DFM}procedure TForm1.FormCreate(Sender: TObject);
var
   HotKeyFile:TStringlist;  //读HotKey文件
   ActionFile:TStringlist;  //读Action文件
   j:integer;
begin
     for j:=1 to 50 do
        DeleteNumber[j]:=0;         //初始化删除的热键的序号     HotKey1.Enabled:=false;
     EpButton1.Enabled:=true;
    EpButton2.Enabled:=false;
     HotKey1.InvalidKeys:=[hcNone];    //设置Hotkey属性
     HotKey1.Modifiers:=[hkext];
    HotKeyFile:=Tstringlist.Create;    //初始化Stringlist
    ActionFile:=Tstringlist.Create;
   if fileexists('c:\HotKey.dat') and fileExists('c:\Action.dat') then       //如果文件存在
   begin    HotKeyFile.LoadFromFile('c:\HotKey.dat');
    ActionFile.LoadFromFile('c:\Action.dat');        for j:=1 to HotKeyFile.Count do               //循环文件的每一行
        begin
         Hotkey[j] := TextToShortCut(HotKeyFile.Strings[j-1]);      //读取HotKey         ShortCutToKey(HotKey[j], KeyValue[j],TheShiftState);       //转换
           ///////////////////////////////////////////////////////
           if ssCtrl in TheShiftState then  KeyMod[j]:=MOD_CONTROL;
           if ssAlt in TheShiftState then KeyMod[j]:=KeyMod[j] or MOD_ALT;
           if ssShift in TheShiftState then KeyMod[j]:=KeyMod[j] or MOD_SHIFT;
           hotkeyid[j]:=GlobalAddAtom(pchar('UserDefineHotKey'))-E[j];
           if (KeyValue[j]<>MOD_CONTROL) and (KeyValue[i]<>MOD_ALT) and (KeyValue[j]<>MOD_SHIFT) then
           RegisterHotKey(Handle, hotkeyid[j], KeyMod[j],KeyValue[j]);//注册热键
          /////////////////////////////////////////////////////////////////////          ExeAction[j]:=ActionFile.Strings[j-1]; //把文件路径赋给ExeAction            with Form1.ListView1.Items.Add do   //添加的ListView
            begin
              Caption:=ShortCutToText(HotKey[j]);
              SubItems.Add(ExeAction[j]);
            end;
         i:=j;  //给全局变量赋值
        end;  //for
    end;   //If 文件存在
       
  HotKeyFile.Free;
  ActionFile.Free;end;  //the first beginprocedure TForm1.RadioButton1Click(Sender: TObject);
begin     if RadioButton1.Checked then
      begin
        HotKey1.Enabled:=true;
        HotKey1.SetFocus;
       EpButton1.Enabled:=true;
      end;end;procedure TForm1.EpButton1Click(Sender: TObject);
var
   j:integer;
beginif i<50 then
   i:=i+1
else
    begin
        ShowMessage('最多只能支持50个热键!(这还不够啊?)');
        i:=i-1;
        exit;
    end; //////////////////////////////
for j:=1 to i do
    if (Hotkey1.HotKey=HotKey[j]) and (DeleteNumber[j]=0) then
       begin
            ShowMessage('这个热键已定义过,请换一个!');
            exit;
       end;
 //////////////////////////// if FileListBox1.FileName='' then
    ExeAction[i]:=DirectoryListBox1.GetItemPath(DirectoryListBox1.ItemIndex)
 else
     ExeAction[i]:=ExeAction[i]+FileListBox1.FileName;
 ShortCutToKey(HotKey1.HotKey, KeyValue[i],TheShiftState);
 if ssCtrl in TheShiftState then  KeyMod[i]:=MOD_CONTROL;
 if ssAlt in TheShiftState then KeyMod[i]:=KeyMod[i] or MOD_ALT;
 if ssShift in TheShiftState then KeyMod[i]:=KeyMod[i] or MOD_SHIFT;
 hotkeyid[i]:=GlobalAddAtom(pchar('UserDefineHotKey'))-E[i];
 if (KeyValue[i]<>MOD_CONTROL) and (KeyValue[i]<>MOD_ALT) and (KeyValue[i]<>MOD_SHIFT) then
    RegisterHotKey(Handle, hotkeyid[i], KeyMod[i],KeyValue[i]);//注册热键 HotKey[i]:=HotKey1.Hotkey; with Form1.ListView1.Items.Add do
 begin
      Caption:=ShortCutToText(HotKey1.HotKey);
      SubItems.Add(ExeAction[i]);
 end;end;/////////////////procedure TForm1.Wmhotkeyhandle(var msg:Tmessage);
var
j:integer;
begin
     for j:=1 to i do
     begin
       if msg.WParam=hotkeyid[j] then
       begin
         msg.Result:=1; //该消息已经处理
         ShellExecute(handle,nil,PChar(ExeAction[j]),nil,nil,SW_SHOWDEFAULT);
       end;     end;
end;/////////////////
procedure TForm1.FormDestroy(Sender: TObject);
var
   j:integer;
begin
     for j:=1 to i do       if DeleteNumber[i]=0 then
      begin
     unregisterhotkey(handle,hotkeyid[i]);        //删除热键
     DeleteAtom(HotKeyID[i]);                      //删除热键
     end;end;
procedure TForm1.EpButton2Click(Sender: TObject);
begin
//     Close;
         Form1.ListView1.Items.Delete(NowItemIndex);    //在ListView中删除
          DeleteNumber[NowItemIndex+1]:=1;              //记录删除的序号          unregisterhotkey(handle,hotkeyid[NowItemIndex+1]);   //删除热键
         DeleteAtom(HotKeyID[NowItemIndex+1]);               //删除热键
end;procedure TForm1.ListView1SelectItem(Sender: TObject; Item: TListItem;
  Selected: Boolean);
begin     if selected then                          //根据焦点控制EpButton的Enable
     begin
        EpButton2.Enabled:=true;
        NowItemIndex:=item.Index;
     end
     else
         EpButton2.Enabled:=false;end;procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
var
   ActionFile,HotKeyFile:textfile;
   j:integer;
begin
     if i>0 then
     begin
     AssignFile(ActionFile,'c:\Action.dat');
     AssignFile(HotKeyFile,'c:\HotKey.dat');
     ReWrite(ActionFile);
     ReWrite(HotKeyFile);
     try        for j:=1 to i do         if (DeleteNumber[j]=0)and(ExeAction[j]<>'')and(ShortcutToText(HotKey[j])<>'') then
         begin
             Writeln(ActionFile,ExeAction[j]);          //写入文件
             Writeln(HotKeyFile,ShortcutToText(HotKey[j]));  //写入文件
        end;     finally
            CloseFile(ActionFile);
            CloseFile(HotKeyFile);
     end;
 end;
end;
end.

解决方案 »

  1.   

    程序没有启动时热键是没有作用的!除非是系统的热键!
    而系统的热键你只要在你的桌面上放一个快捷方式,
    然后用右键->属性->快捷键=Ctrl+Alt+Y
    98要重起后有效,NT、2000马上就可以用了!
      

  2.   

    to cobi(我是小新,我只有5岁):我正是这个意思!!在程序未启动时用热键将它启动,
    to liang_z(千山一刀之忍者神龟):我要的这个热键是想在程序中定义:]
    to kevin_gao(困了!累了!睡觉了!):谢谢你的程序(还没细看),我想问的是这段代码修改
        的是系统热键吗??如果不是,那么大家所说的'系统热键的修改'应该怎么用程序实现???