程序级的自定义热键问题(50分)

保存为string,然后再做类型转换.
 
保存在ini或数据库表中.
 
看来这个问题讨论起来比较麻烦啊,大家想的周到点啊,转换回来的时候不是要用好多if和
else判断?用什么格式保存?怎么读?都是问题啊
 
hexadecimal denary
VK_1 31 49
VK_SHIFT 10 16
VK_Return 0D 13
 

word hexadecimal denary
VK_1 31 49
VK_SHIFT 10 16
VK_Return 0D 13
我回宿舍了.明天见.

 
呵呵,比如人家按了shift+return保存什么?1613?16+13?29?
 
算了,我都没兴致讨论了,分给你们了,呵呵
 
var
s:byte;
begin
s:=2;
keybd_event( s, MapVirtualKey( s, 0 ), 0 , 0 );
if ssShift in shift then showmessage('Shift');
ShowMessage(intToStr(Key));
end;

Bit Meaning
1 Either SHIFT key is pressed.
2 Either CTRL key is pressed.
4 Either ALT key is pressed.
 
ShowMessage(CHR(KEY));
 
你可以把热键但成Integer保存,
读的时候把integer赋给热键。
 
给你一段代码把:用了actionList,和hotkey控件。每次通过hotkey控件改变热键,
然后保存在ini文件里,下次打开的时候,就是上次的热键了。
其实,TShortCut类型就是integer;
procedure TForm1.Button2Click(Sender: TObject);
var
ini: Tinifile;
begin
ini := Tinifile.Create('C:/1.ini');
with ini do
begin
Action1.ShortCut := HotKey1.HotKey;
WriteInteger('sec','shortCut',Action1.ShortCut);
Free;
end;
end;
在程序启动的时候从ini文件里读出快捷方式。
procedure TForm1.FormCreate(Sender: TObject);
begin
if not FileExists('C:/1.ini') then exit;
with Tinifile.Create('C:/1.ini') do
begin
action1.ShortCut := ReadInteger('sec','shortCut',0);
end;
end;
 
算了,没人明白我要的是什么,接受答案了
 
顶部