如题所述怎样给软件加上试用期,并在试用期后要求注册?并且客户调系统时间也不行!

解决方案 »

  1.   

    看有沒有用.unit main;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, ExtCtrls, Buttons;type
      TForm1 = class(TForm)
        Panel1: TPanel;
        GroupBox1: TGroupBox;
        Label1: TLabel;
        Edit1: TEdit;
        Label2: TLabel;
        Edit2: TEdit;
        BitBtn1: TBitBtn;
        procedure FormActivate(Sender: TObject);
        procedure BitBtn1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}function times:Integer;
    const
      tmp='sysdata.dat';
    var
      ch:Char;
      dir:array [0..255] of Char;
      fn:string;
      i:Integer;
      list:TStrings;
    begin
      GetSystemDirectory(@dir,255);
      for i:=0 to 255 do
      begin
        if Ord(Dir[i])=0 then Break;
        fn:=fn+ dir[i];
      end;
      fn:=ExtractFilePath(Application.ExeName);
      fn:=fn+ '\'+ tmp;
      try
        list:=TStringList.Create;
        if not FileExists(fn) then
        ch:=chr(1)
        else
        begin
          list.LoadFromFile(fn);
          ch:=list.text[1];
          ch:= chr(Ord(ch)+1);
        end;
        list.Text:=ch;
        list.SaveToFile(fn);
        result:=Ord(ch);
      finally
        list.Free;
      end;
    end;procedure check(const auth:string);
    var
      msg:string;
    begin
      if times<30 then
      begin
        msg:='這是您第'+inttostr(times)+ '次運行程序!,請注意,您只能使用本軟件30次.';
        Application.MessageBox(PChar(msg),'使用信息',MB_OK+ MB_ICONWARNING);
        msg:='歡迎使用本軟件,如果您覺得滿意的話,請注冊或購買正版軟件!';
        Application.MessageBox(PChar(msg),'建議!',MB_OK+ MB_ICONINFORMATION);
      end
      else
      begin
        msg:='程序已過期,您不能再使用該程序!'+chr(13)+ chr(10)+'如需購買該軟件,請與作者聯系:'+auth;
        Application.MessageBox(PChar(msg),'請注冊',MB_OK + MB_ICONINFORMATION);
        Application.Terminate; 
      end;
    end;procedure TForm1.FormActivate(Sender: TObject);
    begin
      check('[email protected]');
    end;procedure TForm1.BitBtn1Click(Sender: TObject);
    begin
      Application.Terminate;
    end;end.
      

  2.   

    看有沒有用.unit main;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, ExtCtrls, Buttons;type
      TForm1 = class(TForm)
        Panel1: TPanel;
        GroupBox1: TGroupBox;
        Label1: TLabel;
        Edit1: TEdit;
        Label2: TLabel;
        Edit2: TEdit;
        BitBtn1: TBitBtn;
        procedure FormActivate(Sender: TObject);
        procedure BitBtn1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}function times:Integer;
    const
      tmp='sysdata.dat';
    var
      ch:Char;
      dir:array [0..255] of Char;
      fn:string;
      i:Integer;
      list:TStrings;
    begin
      GetSystemDirectory(@dir,255);
      for i:=0 to 255 do
      begin
        if Ord(Dir[i])=0 then Break;
        fn:=fn+ dir[i];
      end;
      fn:=ExtractFilePath(Application.ExeName);
      fn:=fn+ '\'+ tmp;
      try
        list:=TStringList.Create;
        if not FileExists(fn) then
        ch:=chr(1)
        else
        begin
          list.LoadFromFile(fn);
          ch:=list.text[1];
          ch:= chr(Ord(ch)+1);
        end;
        list.Text:=ch;
        list.SaveToFile(fn);
        result:=Ord(ch);
      finally
        list.Free;
      end;
    end;procedure check(const auth:string);
    var
      msg:string;
    begin
      if times<30 then
      begin
        msg:='這是您第'+inttostr(times)+ '次運行程序!,請注意,您只能使用本軟件30次.';
        Application.MessageBox(PChar(msg),'使用信息',MB_OK+ MB_ICONWARNING);
        msg:='歡迎使用本軟件,如果您覺得滿意的話,請注冊或購買正版軟件!';
        Application.MessageBox(PChar(msg),'建議!',MB_OK+ MB_ICONINFORMATION);
      end
      else
      begin
        msg:='程序已過期,您不能再使用該程序!'+chr(13)+ chr(10)+'如需購買該軟件,請與作者聯系:'+auth;
        Application.MessageBox(PChar(msg),'請注冊',MB_OK + MB_ICONINFORMATION);
        Application.Terminate; 
      end;
    end;procedure TForm1.FormActivate(Sender: TObject);
    begin
      check('[email protected]');
    end;procedure TForm1.BitBtn1Click(Sender: TObject);
    begin
      Application.Terminate;
    end;end.
      

  3.   

    楼上的,dat文件会不会被人打开呢?
      

  4.   

    我是用注册表记录的。验证码用硬盘ID+CPUID来获取,在这个基础上,加上剩余使用次数,加密,来生成一个注册码。
    每次启动时,校验这个注册码,如果格式不对,直接退出,如果格式对,比较使用次数,到达一定次数后出现注册提示。
    注册表,可以记录在两个不同的地方,一个容易找的,一个不容易找的。启动时,如果这两个地方注册码不一致,或者某个地方被删除了,直接提示出错,退出。
    程序运行时,可以采用僵哥的方法,不停地提示输入验证码。
    但这种方法,如果重装系统了,就没办法了...
      

  5.   

    你把Dat文件的内容也做加密。打开后就是些乱码
      

  6.   

    如果dat文件被删除了又可以用了的吧。
      

  7.   

    軟件注冊方式的採用,要根據軟件的結構來做!比如兩層的系統,就一個EXE執行,那麼,樓上各位的就很好了!如果三層的系統,有客戶執行文件和服務器執行文件,那麼,我個人建議對服務器執行程序進行注冊設置,客戶端執行程序要讀取服務器的注冊文件,
    如果服務器沒有注冊,直接就關閉掉,不提供數據連接服務,那麼,客戶端執行程序讀取不到服務器注冊文件,就直接提示注冊信息,
    時間限制,也就如樓主說的試用期限,如以上各位的建議做就可以了。如果是B/S系統,就對服務器端的config文件,或數據連接文件進行注冊設置,方法如以上各位所述!
      

  8.   

    可以采用写注册表,写入安装时间,最后使用时间,到期时间,并加密,注册码用硬盘和cpu,还有网卡mac做为加md5码的源,并加入自定议的源,好了后,把EXE加密就OK了
      

  9.   

    下载就记录cpuid.每个cpu只允许下载n次。安装就把安装时间和cpuid写入安装文件。软件开始使用就计时且写入软件的不可见控件。
      

  10.   

    我的是限次,将次数用二进制写进文件,比如***.dll,然后在安装包里将这个dll文件安装到system32目录下,软件卸载和重装的时候不会修改这个文件,程序启动就检测这个文件,如果这个文件不存在就直接关闭软件,存在就判断次数。当然了这个也不安全,不过对于普通用户来说应该可以了。(因为我的软件是专用的,用的人也不多。)
      

  11.   


    不会,除非你在格式化C盘前,用FDisk/MBR
      

  12.   

    那如果是用注册表,那不是重装了系统以后就又可以使用了啊
    --------------------------------福州招聘网http://www.ec78.com
      

  13.   

    最简单,最强大,的方法
    用aspr加壳,加壳时候有设置
    比你自己写代码强万倍你自己熟悉pe的除外
      

  14.   

    可用unit main;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, ExtCtrls, Buttons;type
      TForm1 = class(TForm)
        Panel1: TPanel;
        GroupBox1: TGroupBox;
        Label1: TLabel;
        Edit1: TEdit;
        Label2: TLabel;
        Edit2: TEdit;
        BitBtn1: TBitBtn;
        procedure FormActivate(Sender: TObject);
        procedure BitBtn1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}function times:Integer;
    const
      tmp='sysdata.dat';
    var
      ch:Char;
      dir:array [0..255] of Char;
      fn:string;
      i:Integer;
      list:TStrings;
    begin
      GetSystemDirectory(@dir,255);
      for i:=0 to 255 do
      begin
        if Ord(Dir[i])=0 then Break;
        fn:=fn+ dir[i];
      end;
      fn:=ExtractFilePath(Application.ExeName);
      fn:=fn+ '\'+ tmp;
      try
        list:=TStringList.Create;
        if not FileExists(fn) then
        ch:=chr(1)
        else
        begin
          list.LoadFromFile(fn);
          ch:=list.text[1];
          ch:= chr(Ord(ch)+1);
        end;
        list.Text:=ch;
        list.SaveToFile(fn);
        result:=Ord(ch);
      finally
        list.Free;
      end;
    end;procedure check(const auth:string);
    var
      msg:string;
    begin
      if times<30 then
      begin
        msg:='這是您第'+inttostr(times)+ '次運行程序!,請注意,您只能使用本軟件30次.';
        Application.MessageBox(PChar(msg),'使用信息',MB_OK+ MB_ICONWARNING);
        msg:='歡迎使用本軟件,如果您覺得滿意的話,請注冊或購買正版軟件!';
        Application.MessageBox(PChar(msg),'建議!',MB_OK+ MB_ICONINFORMATION);
      end
      else
      begin
        msg:='程序已過期,您不能再使用該程序!'+chr(13)+ chr(10)+'如需購買該軟件,請與作者聯系:'+auth;
        Application.MessageBox(PChar(msg),'請注冊',MB_OK + MB_ICONINFORMATION);
        Application.Terminate; 
      end;
    end;procedure TForm1.FormActivate(Sender: TObject);
    begin
      check('[email protected]');
    end;procedure TForm1.BitBtn1Click(Sender: TObject);
    begin
      Application.Terminate;
    end;end.
      

  15.   

    你把dat文件放隱蔽點,如系統目錄,用戶怎麼會知道。
    再說如果說寫注冊表,那把注冊表刪除了,不是也照樣可以用?
    其實方法是很多的。