欧美大屁股bbbbxxxx,狼人大香伊蕉国产www亚洲,男ji大巴进入女人的视频小说,男人把ji大巴放进女人免费视频,免费情侣作爱视频

歡迎來到入門教程網(wǎng)!

Delphi

當(dāng)前位置:主頁 > 軟件編程 > Delphi >

Delphi實現(xiàn)限定軟件使用時間的方法

來源:本站原創(chuàng)|時間:2020-01-10|欄目:Delphi|點擊: 次

我們經(jīng)??吹胶芏嗑W(wǎng)上下載的試用版軟件,都有使用時間的限制,就其商業(yè)角度而言也是處于軟件效益保護的一種措施,可以讓用戶免費試用一段時間,若滿意就可以購買商業(yè)軟件。本文所述實例代碼功能就是如何為Delphi所編寫的程序添加使用時間的限制功能,這里默認(rèn)的時限為30天。

主要代碼如下:

unit Unit1;
interface
uses
 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
 Registry, Dialogs;
type
 TForm1 = class(TForm)
  procedure FormCreate(Sender: TObject);
 private
  { Private declarations }
 public
  { Public declarations }
 end;
var
 Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
var
  registerTemp : TRegistry;
  curDate : TDateTime;
begin
  registerTemp := TRegistry.Create;
  with registerTemp do
  begin
    RootKey := HKEY_LOCAL_MACHINE;
    //判斷是否初次運行程序
    if OpenKey('Software\MySoftware',True) then
    begin
      if ReadBool('Runned') then
      //不是第一次運行
      begin
        curDate := Date;
        if (curDate-ReadTime('LastRunTime'))>=ReadInteger('Duration') then
        begin
          //當(dāng)前的系統(tǒng)時間超出了使用期限
          ShowMessage('試用版已到期');
          exit;
        end
        else
        begin
          DeleteKey('LastRunTime');
          WriteTime('LastRunTime',Date);
        end;
      end
      else
      begin
        //初次運行程序
        DeleteKey('Runned');
        WriteBool('Runned',True);
        //設(shè)置試用期限30天
        WriteInteger('Duration',30);
        //寫入當(dāng)前運行時間
        WriteTime('LastRunTime',Date);
      end;
    end
    else
    begin
      ShowMessage('Fails!');
    end;
    CloseKey;
  end;
end;
end.

上一篇:Delphi下OpenGL2d繪圖之畫點的方法

欄    目:Delphi

下一篇:Delphi實現(xiàn)碰撞球體完整實例代碼

本文標(biāo)題:Delphi實現(xiàn)限定軟件使用時間的方法

本文地址:http://mengdiqiu.com.cn/a1/Delphi/8638.html

網(wǎng)頁制作CMS教程網(wǎng)絡(luò)編程軟件編程腳本語言數(shù)據(jù)庫服務(wù)器

如果侵犯了您的權(quán)利,請與我們聯(lián)系,我們將在24小時內(nèi)進行處理、任何非本站因素導(dǎo)致的法律后果,本站均不負(fù)任何責(zé)任。

聯(lián)系QQ:835971066 | 郵箱:835971066#qq.com(#換成@)

Copyright © 2002-2020 腳本教程網(wǎng) 版權(quán)所有