delphi 小白再次问~~~~

来源:百度知道 编辑:UC知道 时间:2024/06/03 16:36:36
怎么检查一个热键是否被用??????

而且怎么拆分 hotkey控键中的hotkey中的组合键????(据说是string/???)

一个比较笨的方法,你注册所有可能的热键,失败就是已被注册了(来自大富翁论坛)
我也刚刚学delphi不久 可以相互交流哦 QQ 282284536

另外第二个问题也解决了:
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls,Menus;

type
TForm1 = class(TForm)
hk1: THotKey;
btn1: TButton;
procedure btn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.btn1Click(Sender: TObject);
var
TheKey: Word;
TheShiftState: TShiftState;
str: string;
Ch : Char;
begin
ShortCutToKey(hk1.HotKey,TheKey,TheShiftState);
Ch:=Char(TheKey);
ShowMessage(Ch);

if TheShiftState=[ssShift] then
str:='Shift'
else
if TheShiftStat