DELPHI 外挂源码 适合初学者

源代码在线查看: unit1.~pas

软件大小: 11 K
上传用户: ivanyeh
关键词: DELPHI 源码 初学者
下载地址: 免注册下载 普通下载 VIP

相关代码

				unit Unit1;
				
				interface
				
				uses
				  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
				  Dialogs;
				
				type
				  TForm1 = class(TForm)
				    procedure FormCreate(Sender: TObject);
				    procedure FormClose(Sender: TObject; var Action: TCloseAction);
				  private
				    { Private declarations }
				  public
				          HotkeyF1,HotKeyF2:integer;   
				          procedure   WMHotkeyHandle(var   Msg:   TMessage);   message   WM_HOTKEY;  
				    { Public declarations }
				  end;
				
				var
				  Form1: TForm1;
				
				implementation
				  uses Unit2;
				{$R *.dfm}
				
				{ TForm1 }
				//比较两个字符串是否相同
				function WooolCompareStr(s1, s2: string): Boolean;
				begin
				  result := False;
				  if (Length(s1) < 8) or (Length(s2) < 8) then exit; //判断s1,s2长度小于不小于8
				  result := (s1[1] = s2[1]) and (s1[2] = s2[2]) and (s1[3] = s2[3]) and (s1[4] = s2[4]) and
				    (s1[5] = s2[5]) and (s1[6] = s2[6]) and (s1[7] = s2[7]) and (s1[8] = s2[8]);
				end;
				
				
				
				{ TForm1 }
				
				procedure TForm1.WMHotkeyHandle(var Msg: TMessage);
				begin
				      if   Msg.WParam=HotkeyF1   then   
				            ShowMessage('alt+F1');   
				      if   Msg.WParam=HotkeyF2   then   
				            //ShowMessage('ctrl+q');
				            Form2.ShowModal;
				
				end;
				
				procedure TForm1.FormCreate(Sender: TObject);
				begin
				      HotKeyF1:=GlobalAddAtom(pchar('UserDefinsHotKey1'))-$C000;   
				      RegisterHotKey(Form1.Handle,HotKeyF1,MOD_ALT   ,VK_F1);                     //alt+F1   
				      HotkeyF2:=GlobalAddAtom(pchar('UserDefinsHotKey2'))-$C000;
				      RegisterHotKey(Form1.Handle,HotkeyF2,   MOD_CONTROL   ,ord('Q'));     //ctrl+q   
				end;
				
				procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
				begin
				      UnregisterHotKey(Form1.Handle,1);   
				      DeleteAtom(HotkeyF1);   
				      DeleteAtom(HotkeyF2);   
				end;
				
				end.
				 			

相关资源