|
Protection API - SDP_GetNumOfExecutionsLeft
SDP_GetNumOfExecutionsLeft
The SDP_GetNumOfExecutionsLeft function is used to obains the number
of executions remaining in the trial period.
For C++:
int SDP_GetNumOfExecutionsLeft(
LPDWORD lpdwNum // disposition value buffer ); For Delphi:
function SDP_GetNumOfExecutionsLeft( lpdwNum :PDWORD // disposition value buffer
): Integer;
|
Parameters
- lpdwNum
- [out] Pointer to a variable that receives the number of executions remaining
in the trial period
Return Values
- If the function succeeds, the return value is 1.
if trial period has expired, the return value is -1.
If the function fails, the return value is zero.
Remarks
- Be aware, if you use two (or three) of "Number of days"
, "Number of executions" and "Expiration Date" parameters
in "Trial Info" Tab, one of them has expired means trial period
has expired. For instance, if you both set "Expiration Date"
and "Number of executions" parameters, and only expiration
date has expired, if you call SDP_GetNumOfExecutionsLeft, you will get
return value of -1 even if number of executions remaining in the trial
period is not zero.
the cause of function fail can be you do not set "Number of executions"
parameters in "Trial Info" Tab.
Example
- ffor C/C++
- #include "SDProtector.h"
//...
void GetExecs()
{
DWORD dNumofExec;
char szInfo[256];
int iResult;
iResult=SDP_GetNumOfExecutionsLeft(&dNumofExec); if(iResult==1) { //If succeeded sprintf(szInfo,"you have %d execution(s)left",dNumofExec); ::MessageBox(NULL,szInfo,"Expiration Info",MB_ICONINFORMATION); } else if(iResult==-1) { //if expired ::MessageBox(NULL,"Sorry, you trial period has expired","Error",MB_ICONINFORMATION); } else { //if failed ::MessageBox(NULL,"Get number Of executions error","Error",MB_ICONINFORMATION);
}
}
- for Delphi
- procedure GetExpirationDate;
var dNumofExec: LongWord; szInfo: String; iResult:Integer; begin iResult:=SDP_GetNumOfExecutionsLeft(@dNumofExec); if iResult= 1 then begin szInfo=format('you have %d execution(s) left',[dNumofExec]); MessageBox(0,@szInfo[1],'Expiration Info', MB_ICONINFORMATION); end else if iResult= -1 then MessageBox(0,'Sorry, you trial period has expired','Error',MB_ICONINFORMATION) else MessageBox(0,'Get number Of executions error','Error',MB_ICONINFORMATION); end;
Sample application is located in \Examples\Delphi\API\ and \Examples\VC\API\
directory.
|