Click here to Skip to main content
15,899,314 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear Sirs,
I am beginner in C++ and have problem with one my program.
I am C++ dll for protection my Expert advisor(Metatrader software).
I want make demo version for my client and want using time limit on that.
For example each client able use this software for 7 days and after that not workable for him/her.
I want simple code that check this time for me.
I am using win32 console.
Thanks.

/Edit M - Crossposting in forum[^]
Posted
Updated 5-May-10 6:33am
v3

There are different ways to achieve this

1) encrypted license files that contains the expiry dates etc.
2) encrypted license keys held in the registry
3) challenge/response mechanism which require an internet connection
4) probably others.......

Nobody is just going to give you a solution...you come up with the code, and if you get stuck then come and ask specifics.
 
Share this answer
 
Dear Sir,
Thank you for your email.
You can find my source code in below.
I make with this source dll and dll will connect to another software for do something for me.
I want add one code to this that after Xdays not send signal to my other program.

#define WIN32_LEAN_AND_MEAN  // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
//----
#define MT4_EXPFUNC __declspec(dllexport)
/

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
 int Len = 14;
double ld_0;
   double ld_8;
   double ld_16;
   double ld_24;
   double ld_32;
   double ld_40;
   double ld_48;
   double ld_56;
   double ld_64;
   double ld_72;
   double ld_80;
   double ld_88;
   double ld_96;
   double ld_104;
   double ld_112;
   double ld_120;
   double ld_128;
   double ld_136;
   double ld_144;
   double ld_152;
   double ld_160;
   double ld_168;
   double ld_176;
   double ld_184;
   double ld_192;
   double ld_200;
   double ld_208;
   
MT4_EXPFUNC double __stdcall Sig(double Ba,int ld_216,double Hi,double Lo,double Clo)
  {
	   
	 for (int li_224 = ld_216; li_224 >= 0; li_224--) {
      if (ld_8 == 0.0) {
         ld_8 = 1.0;
         ld_16 = 0.0;
         if (Len - 1 >= 5) ld_0 = Len - 1.0;
         else ld_0 = 5.0;
         ld_80 = 100.0 * ((Hi + Lo + Clo) / 3.0);
         ld_96 = 3.0 / (Len + 2.0);
         ld_104 = 1.0 - ld_96;
      } else {
         if (ld_0 <= ld_8) ld_8 = ld_0 + 1.0;
         else ld_8 += 1.0;
         ld_88 = ld_80;
         ld_80 = 100.0 * ((Hi + Lo + Clo) / 3.0);
         ld_32 = ld_80 - ld_88;
         ld_112 = ld_104 * ld_112 + ld_96 * ld_32;
         ld_120 = ld_96 * ld_112 + ld_104 * ld_120;
         ld_40 = 1.5 * ld_112 - ld_120 / 2.0;
         ld_128 = ld_104 * ld_128 + ld_96 * ld_40;
         ld_208 = ld_96 * ld_128 + ld_104 * ld_208;
         ld_48 = 1.5 * ld_128 - ld_208 / 2.0;
         ld_136 = ld_104 * ld_136 + ld_96 * ld_48;
         ld_152 = ld_96 * ld_136 + ld_104 * ld_152;
         ld_56 = 1.5 * ld_136 - ld_152 / 2.0;
         ld_160 = ld_104 * ld_160 + ld_96 * fabs(ld_32);
         ld_168 = ld_96 * ld_160 + ld_104 * ld_168;
         ld_64 = 1.5 * ld_160 - ld_168 / 2.0;
         ld_176 = ld_104 * ld_176 + ld_96 * ld_64;
         ld_184 = ld_96 * ld_176 + ld_104 * ld_184;
         ld_144 = 1.5 * ld_176 - ld_184 / 2.0;
         ld_192 = ld_104 * ld_192 + ld_96 * ld_144;
         ld_200 = ld_96 * ld_192 + ld_104 * ld_200;
         ld_72 = 1.5 * ld_192 - ld_200 / 2.0;
         if (ld_0 >= ld_8 && ld_80 != ld_88) ld_16 = 1.0;
         if (ld_0 == ld_8 && ld_16 == 0.0) ld_8 = 0.0;
      }
      if (ld_0 < ld_8 && ld_72 > 0.0000000001) {
         ld_24 = 50.0 * (ld_56 / ld_72 + 1.0);
         if (ld_24 > 100.0) ld_24 = 100.0;
         if (ld_24 < 0.0) ld_24 = 0.0;
      } else ld_24 = 50.0;
      return(ld_24);
   }
  
  }




Thanks.
 
Share this answer
 
v2
Comments
Tarakeshwar Reddy 5-May-10 14:07pm    
When ever you add code, use the
 tags or just select your code and click on the code block button. It makes it easier to read the code

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900