?? unit2.pas
字號(hào):
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, AAFont, AACtrls, jpeg, ExtCtrls, LbSpeedButton,Registry ;
type
TForm2 = class(TForm)
Image1: TImage;
Image2: TImage;
AALabel9: TAALabel;
AALabel2: TAALabel;
AALabel1: TAALabel;
AALabel3: TAALabel;
LbSpeedButton5: TLbSpeedButton;
LbSpeedButton6: TLbSpeedButton;
LbSpeedButton8: TLbSpeedButton;
AALabel4: TAALabel;
procedure LbSpeedButton5Click(Sender: TObject);
procedure LbSpeedButton6Click(Sender: TObject);
procedure LbSpeedButton8Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
function CreateMutex: Boolean; // 全項(xiàng)目公用函數(shù)
procedure DestroyMutex; // 全項(xiàng)目公用函數(shù)
var
Form2: TForm2;
REG:TRegistry;
Mutex: hWnd;
implementation
uses mainunit, REGUnit,SoftReg;
{$R *.dfm}
procedure DestroyMutex;
begin
if Mutex <> 0 then CloseHandle(Mutex);
end;
function CreateMutex: Boolean;
var
PrevInstHandle: THandle;
AppTitle: PChar;
begin
AppTitle := StrAlloc(100);
StrPCopy(AppTitle, Application.Title);
Result := True;
Mutex := Windows.CreateMutex(nil, False, AppTitle);
if (GetLastError = ERROR_ALREADY_EXISTS) or (Mutex = 0) then begin
Result := False;
SetWindowText(Application.Handle, '');
PrevInstHandle := FindWindow(nil, AppTitle);
if PrevInstHandle <> 0 then begin
if IsIconic(PrevInstHandle) then
ShowWindow(PrevInstHandle, SW_RESTORE)
else
BringWindowToTop(PrevInstHandle);
SetForegroundWindow(PrevInstHandle);
end;
if Mutex <> 0 then Mutex := 0;
end;
StrDispose(AppTitle);
end;
procedure TForm2.LbSpeedButton5Click(Sender: TObject);
begin
if Application.MessageBox('是否真的退出“商品房買賣合同套打程序”?','詢問'
,MB_YESNO+MB_ICONQUESTION )=IDYES then
Application.Terminate ;
end;
procedure TForm2.LbSpeedButton6Click(Sender: TObject);
begin
Form1:=TForm1.Create(self);
form1.ShowModal ;
end;
procedure TForm2.LbSpeedButton8Click(Sender: TObject);
begin
If Assigned(RegSoftForm) Then Begin
SetWindowPos(RegSoftForm.Handle, 0, 0, 0, 0, 0, swp_nomove +
swp_nosize);
Exit;
End;
RegSoftForm := TRegSoftForm.create(self);
RegSoftForm.ShowModal;
end;
procedure TForm2.FormCreate(Sender: TObject);
var
nows,firstruns:TDate;
bFirst:Boolean ;
sMcode,sNo,SReg:string;
begin
nows:=Date;
REG:=TRegistry.Create ;
REG.RootKey := HKEY_LOCAL_MACHINE;
bfirst:=not reg.KeyExists('SOFTWARE\ABICO\HTPrinter');
if bfirst then BEGIN
Application.MessageBox('你是第一次運(yùn)行這個(gè)程序!你暫時(shí)只能使用5天!'+#13+
'如要繼續(xù)使用請(qǐng)與安邦公司聯(lián)系取得注冊(cè)碼并進(jìn)行注冊(cè)!',
'提示',MB_OK+MB_ICONINFORMATION );
END;
REG.OpenKey('SOFTWARE\ABICO\HTPrinter', true);
if bfirst then
REG.WriteBinaryData('FirstRun',nows,SizeOf(nows));
reg.WriteBinaryData('Now',nows,SizeOf(nows));
REG.ReadBinaryData('now',nows,SizeOf(nows));
REG.ReadBinaryData('firstrun',firstruns ,SizeOf(firstruns ));
if (nows-firstruns>5)OR(nows-firstruns<0) then begin
IF REG.ValueExists('KEY_ID') then begin
sMcode :=REGUnit.GetMachineCode ;
SNO:=REGUnit.GetSNFromMCode(SMCODE);
SREG:= REG.ReadString('KEY_ID');
// ShowMessage('SNO='+sNo+#13+'SREG='+SReg);
if sNo=SREG theN BEGIN
LbSpeedButton6.Visible :=TRUE;
LbSpeedButton8.Visible :=FALSE;
REG.FREE;
Exit;
end;
END;{ ELSE begin
Application.MessageBox('軟件已超出使用期限且未注冊(cè)!'+#13+
'如要繼續(xù)使用請(qǐng)與安邦公司聯(lián)系取得注冊(cè)碼并進(jìn)行注冊(cè)!',
'警告',MB_OK+MB_ICONERROR );
LbSpeedButton6.Visible :=False;
LbSpeedButton8.Visible :=TRUE;
REG.FREE;
Exit;
END; }
Application.MessageBox('軟件已超出使用期限!'+#13+
'如要繼續(xù)使用請(qǐng)與安邦公司聯(lián)系取得注冊(cè)碼并進(jìn)行注冊(cè)!',
'警告',MB_OK+MB_ICONERROR );
LbSpeedButton6.Visible :=False;
LbSpeedButton8.Visible :=TRUE;
end ELSE begin
LbSpeedButton6.Visible :=TRUE;
LbSpeedButton8.Visible :=TRUE;
END;
REG.FREE;
end;
end.
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -