1,用hook
http://crob.net/delphi/source/dphood.zip
简单的hook源程序2,避免两个实例运行
procedure TForm1.FormCreate(Sender: TObject);
Var Ret:Integer;
    b:boolean;
    tmpstr: string;
begin
CreateMutex(nil,False,'aaaaaa');
Ret:=GetLastError;
  if Ret = ERROR_ALREADY_EXISTS Then begin
     Application.MessageBox('已经运行', '重复运行', MB_OK + MB_ICONEXCLAMATION);
     Application.Terminate;
  end;
end;

解决方案 »

  1.   

    在hook中的回调函数中拦截wParam = 18就是Alt键
      

  2.   

    1.你可以设置form1.keypriview:=true,在form1.onkeydown里判断,假如有alt按下,则form1.setfocus(或者其它你想focus的东东)
    2.给你一个比较简单的防止程序执行两次的方法
    implementation 
    var hnd: THandle;initialization
        hnd := CreateMutex(nil, True, 'irgendwaseinmaliges');
        if GetLastError = ERROR_ALREADY_EXISTS then Halt;finalization
        if hnd <> 0 then CloseHandle(hnd);
    end.
      

  3.   

    1.你可以设置form1.keypriview:=true,在form1.onkeydown里判断,假如有alt按下,则form1.setfocus(或者其它你想focus的东东)
    2.给你一个比较简单的防止程序执行两次的方法
    implementation 
    var hnd: THandle;initialization
        hnd := CreateMutex(nil, True, 'irgendwaseinmaliges');
        if GetLastError = ERROR_ALREADY_EXISTS then Halt;finalization
        if hnd <> 0 then CloseHandle(hnd);
    end.
      

  4.   

    我觉用Alt挺好的,一个人的习惯吗!
      

  5.   

    SystemParametersInfo(SPI_SETFASTTASKSWITCH,1,0,0);  //Hide AIT-TAB
    SystemParametersInfo(SPI_SCREENSAVERRUNNING,1,0,0);  //HIDE  CLT-ALT-Del
      
      

  6.   

    在hook中的回调函数中拦截wParam = 18就是Alt键