oracle基础知识讲义
源代码在线查看: unitfrmmain.pas
unit unitFrmMain;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
hotkeyid: integer;
procedure WMhotkeyhandle(var msg: Tmessage);
message WM_HOTKEY; //响应热键消息
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
begin
hotkeyid := GlobalAddAtom(pchar
('UserDefineHotKey')) - $C000;
//减去$C000是为了保证取值范围的限制
registerhotkey(handle, hotkeyid,
MOD_WIN or MOD_ALT or MOD_CONTROL, $41);
//热键为WIN键+ ctrl+Alt+A
end;
procedure TForm1.WMhotkeyhandle(var msg: Tmessage);
begin
if (msg.LParamHi = $41) and
(msg.lparamLo = MOD_CONTROL or mod_Alt or MOD_WIN) then
begin
msg.Result := 1; //该消息已经处理
application.BringToFront;
ShowMessage('你已经按下热键')
end;
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
unregisterhotkey(handle, hotkeyid);
DeleteAtom(HotKeyID);
end;
end.