⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 demo.cpp

📁 包括 LIB、DLL 加密模块 各种语言调用加密模块的例子程序等
💻 CPP
字号:
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "demo.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
HINSTANCE gLiblocking=NULL;

typedef  int (_stdcall * REGISTER)(int rw);
typedef int (_stdcall * TESTKEY)(int Idate,char * testlock,int Ok_No);

REGISTER TKRegister;
TESTKEY Testkey;

//----------------------------------------------//
//----TODO: Add extra initialization here-------//
//----------------------------------------------//
int	mima=-1;			//Registered: mima=0,  No registered and  the trial period is up: mima=-1
char	testlock[10];
//----------------------------------------------//
//----------------------------------------------//
//----------------------------------------------//

//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm1::FormCreate(TObject *Sender)  //
{
	if(gLiblocking!=NULL)
	{
		ShowMessage("The locking.dll has already been loaded.");
		return;
	}
	gLiblocking=LoadLibrary("locking.dll");
	if(gLiblocking==NULL)
	{
		char msg[300];
		strcpy(msg,"Cannot load the locking.dll DLL.");
		strcat(msg,"Make sure that the file locking.dll");
		strcat(msg,"is in you \\WINDOWS\\SYSTEM directory.");
		ShowMessage(msg);
	}

	Testkey=(TESTKEY)GetProcAddress(gLiblocking,"Testkey");
	TKRegister=(REGISTER)GetProcAddress(gLiblocking,"TKRegister");

//----------------------------------------------//
//----TODO: Add extra initialization here-------//
//----------------------------------------------//

	mima=Testkey(30, testlock, 0);

//	mima=Testkey(30, testlock, 1);
//	mima=TKRegister(2);
//----------------------------------------------//
//----------------------------------------------//
//----------------------------------------------//


}

void __fastcall TForm1::Button1Click(TObject *Sender)
{
        int i;
        mima=TKRegister(0);      // REGISTER
        if(mima==0)for(i=0;i<10;i++)testlock[i]=0;

}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button2Click(TObject *Sender)
{
        int i;
        if(TKRegister(1)==0){         //DEREGISTER
                mima=-1;
                for(i=0;i<10;i++)testlock[i]=0;
                }

}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button3Click(TObject *Sender)
{

        int   Myint;
        if(mima==0)
                ShowMessage("The program can run");
        else ShowMessage("The program cann't run");
//'
//'
//'
//'
//'
//'
        if(testlock[5]==15)      //test testlock
                ShowMessage("The testlock is ok, the program can run");
        else ShowMessage("The testlock is error, the program cann't run");
//'
//'
//'
        if(testlock[9]==18)      //test testlock
                ShowMessage("The testlock is ok, the program can run");
        else ShowMessage("The testlock is error, the program cann't run");
//'
//'
//'
//'
//'


}
//---------------------------------------------------------------------------

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -