Click here to Skip to main content
15,912,329 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am working on project requires to find the TIMESPAN between software installation date and Software expiring date. I need software to pop up screen to calculate 30 days and it reduces as day has gone. As it is mentioned in first AfxMessageBox like:
C++
{ strMessage.Format( "ADDapt was not activated within 30 days of " "installation and is currently not functional.\n" "To activate please call Avtron Field Service at 000-000-1230 " "ext 1214.\n" "The 30 days trial period starts on the day you installed " "ADDapt.\n" "You have %d days left to renew ADDapt Software.", daysLeft );

I need to show the days left in %d

Once the software reches 27th day I need software to view following Message :
C++
strMessage.Format(_T("ADDapt is operating under a trial license. \n
                 _T("You have %d" " days to activate ADDapt with valid license, \n")
   _T("To activate, Please call Avtron Field Service at 000-000-0000."), daysLeft);

Once software expire from trial period I need to show security page which has Productcode which will activate the software

My biggest hurdle is to register this product in window registery and once the installdate is figured out then it is easy to work with

Thank you very much

Vijay Patel
feel free to call at [removed]

CODE I WORKED is as follow:

C++
COleDateTime timeStart, timeEnd; 
COleDateTimeSpan timePassed;
 int daysLeft = 0;
 timeStart = COleDateTime::GetCUrrentTime();
timeEnd = 
timePassed = COleDateTime::GetCurrentTime( ) - timeStart;
 daysLeft = 30 - static_cast< int >( timePassed.GetTotalDays( ) );
 CString strMessage;
 if( daysLeft > 0 )
 { strMessage.Format( "ADDapt was not activated within 30 days of " "installation and is currently not functional.\n" "To activate please call Avtron Field Service at 216-642-1230 " "ext 1214.\n" "The 30 days trial period starts on the day you installed " "ADDapt.\n" "You have %d days left to renew ADDapt Software.", daysLeft );
 }
 Else
 { 
strMessage.Format(_T("ADDapt is operating under a trial license. \n
                   _T("You have %d" " days to activate ADDapt with valid license, \n")
                   _T("To activate, Please call Avtron Field Service at 000-000-0000."), daysLeft); 
}
 AfxMessageBox( strMessage );

Other code to register product is as follow:

BOOL gotTime= FALSE;
if(!gotTime)
{
if (ProductCode !+ OXeO)
else
//Code for time registration goes here
gotTime=TRUE

}
Posted
Updated 21-Sep-11 18:38pm
v3
Comments
walterhevedeich 22-Sep-11 0:40am    
I have removed the telephone number you posted, for your own good. :)
Seriously, you don't need to post it. If someone knows the answer, you will receive it in this same forum.
Vijay Pate 22-Sep-11 8:30am    
thank you very much
Richard MacCutchan 22-Sep-11 4:24am    
Sorry, but what exactly is your question; does some part of the above code not work?
Vijay Pate 22-Sep-11 15:33pm    
when software get install I need installdate registered in REGEDIT(Registry) and take the date of install -1 every day till day 30 days over. messagebox mentione you have one less day goes for first Messagebox

and when software trial period will expire in 3 days left which will prompt customer to 2nd Messagebox and ask to upgrade the license by calling tech support.
Vijay Pate 22-Sep-11 8:29am    
I need to calculate how many days left before product or software expires. With this code I need to register this product in window registry with install date to determind when was product install and from that install date I need to determind 30 days .

Thank you very much.

Vijay Patel

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