if (GetKeyState(VK_control)<>0) and (GetKeyState(VK_shift)<>0) then
这行代码它只能获取ctrl按键的状态。而不能获取shift按键的状态。请问如何获取同时按下的状态急急。3ks

解决方案 »

  1.   

    GetKeyboardState()应该可以满足你的要求
      

  2.   

    procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    begin
      if (ssCtrl in Shift) and (key = VK_Shift) then
        showmessage('');
    end;
      

  3.   

    补充一下,
    procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    begin
         if ((ssCtrl in Shift) and (key = VK_Shift)) or ((ssShift in Shift) and (key = VK_CONTROL)) then
        showmessage('');end;
      

  4.   

    这个也可以啊
    if   (GetKeyState(VK_control) <> 0)   and   (GetKeyState(VK_shift) <> 0)   then