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:
{ 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 :
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:
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
}