如何制作按住Alt键的同时键入按键s,h,e,n,g的响应事件?
解决方案 »
- delphi连接查询MYSQL的问题
- MDI窗口关闭的奇怪问题
- 如何继承一个active form
- 我想在程序中实现IP查主机和域名的功能
- 请问高手:怎样按下一个button,把指定目录下的所有扩展名为txt文本文件全删了?
- Delphi中用adoquery连接Access数据库时,怎样设置连接密码或用什么方法连接???
- 急急急!!!100!请问怎样让canvas画图的区域是透明的,即它的画图区域不遮盖后面的东西!
- shellexcute怎么用阿?
- ?????CSDN的合订本的配套光盘有2张是IBM的,广告上怎不注明呢??????
- 征集软件名称
- treeview中的内存释放问题
- 存储过程传递参数出错
procedure OnSysKeyDown(AHnd: HWND; var AMsg: TWMSysKeyDown);
procedure OnChar(AHnd: HWND; var AMsg: TWMChar);
就可以吧,我没试过,你搞定它。
(如果是Form响应时间,同时窗体上有WinControl,要设置窗体的KeyPreview=True)var
Form1: TForm1;
Stage: Integer;procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if Key = 18 then
Exit; if Stage = 0 then
if ((GetKeyState(VK_LMENU) and $80 <> 0) or (GetKeyState(VK_RMENU) and $80 <> 0)) and
(GetKeyState(Ord('S')) and $80 <> 0) then
begin
Stage := 1;
Exit;
end
else
Stage := 0; if Stage = 1 then
if ((GetKeyState(VK_LMENU) and $80 <> 0) or (GetKeyState(VK_RMENU) and $80 <> 0)) and
(GetKeyState(Ord('H')) and $80 <> 0) then
begin
Stage := 2;
Exit;
end
else
Stage := 0; if Stage = 2 then
if ((GetKeyState(VK_LMENU) and $80 <> 0) or (GetKeyState(VK_RMENU) and $80 <> 0)) and
(GetKeyState(Ord('E')) and $80 <> 0) then
begin
Stage := 3;
Exit;
end
else
Stage := 0; if Stage = 3 then
if ((GetKeyState(VK_LMENU) and $80 <> 0) or (GetKeyState(VK_RMENU) and $80 <> 0)) and
(GetKeyState(Ord('N')) and $80 <> 0) then
begin
Stage := 4;
Exit;
end
else
Stage := 0; if Stage = 4 then
if ((GetKeyState(VK_LMENU) and $80 <> 0) or (GetKeyState(VK_RMENU) and $80 <> 0)) and
(GetKeyState(Ord('G')) and $80 <> 0) then
begin
ShowMessage('ok');
Stage := 0;
end
else
Stage := 0;
end;
不过字符键总归不能几个同时按,要按顺序:)
begin
case (Msg.wParam) of
ord('R'):
if (GetKeyState(VK_CONTROL) and $80 = $80) then
__S := __S + 'r';
ord('E'):
if (GetKeyState(VK_CONTROL) and $80 = $80) then
__S := __S + 'e';
ord('D'):
if (GetKeyState(VK_CONTROL) and $80 = $80) then
begin
__S := __S + 'd';
if StrUpper(PChar(__S)) = 'RED' then begin
Self.Image1.Visible := True;
end;
__S := ''; end;
else
__S := '';
end;
end;
if (shift=[ssCTRL]) and (key>=$41) and (key<=$5A) then
begin
keytp:=keytp+chr(key);
if keytp='ZT' then
begin
showmessage('ztqy-20031219')
end;
end;