EP_TrialExecutionTime
EP_TrialExecutionTime function servers for retrieving the total trial period minutes and the trial period minutes left since the module start. The total number of trial minutes should be defined in TRIAL CONTROL - Limitation of execution time panel. See also the extended functions EP_TrialExecutionTimeLeft and EP_TrialExecutionTimeTotal.
Parameters
- Total - the total number of trial minutes.
- Left - the number of trial minutes left.
Return Value
If the function succeeds, the return value is 1. If the function fails, the return value is 0.
Remark
The function fails in the following cases:
- the limitation of the execution time was not enabled;
- the application is not protected.
Definition
Show/Hide C++ function definition
extern "C" __declspec( dllimport ) __stdcall BOOL EP_TrialExecutionTime( int* Total, int* Left );
Show/Hide Delphi function definition
function EP_TrialExecutionTime( var Total, Left : Cardinal) : boolean; stdcall;
Show/Hide Visual Basic function definition
Public Declare Function EP_TrialExecutionTime Lib "enigma_ide.dll" (ByRef Total As Long, ByRef Left As Long) As Byte
Show/Hide C# (.NET) function definition
public class Enigma_IDE
{
[DllImport("enigma_ide.dll", CallingConvention = CallingConvention.StdCall)]
public static extern bool EP_TrialExecutionTime(ref Int32 Total, ref Int32 Left);
}
Examples
Show/Hide Delphi function example
uses
enigma_ide;
procedure TfrmMain.tmTimerTimer(Sender: TObject);
var
lpSystemTime : _SYSTEMTIME;
dwMinutesTotal : Cardinal;
dwMinutesLeft : Cardinal;
begin
GetSystemTime(lpSystemTime);
eGlobalTime.Text := format('%.2d:%.2d:%.2d', [lpSystemTime.wHour, lpSystemTime.wMinute, lpSystemTime.wSecond]);
inc(dwExecutionTime, tmTimer.Interval);
eExecutionTime.Text := format('%.2d:%.2d:%.2d', [(dwExecutionTime div (60*60*1000)) mod 24, (dwExecutionTime div (60*1000)) mod 60, (dwExecutionTime div (1000)) mod 60]);
if EP_TrialExecutionTime(dwMinutesTotal, dwMinutesLeft) then
begin
eStatus.Color := clGreen;
eStatus.Text := 'OK';
eTotalExecutionTime.Text := IntToStr(dwMinutesTotal);
eLeftExecutionTime.Text := IntToStr(dwMinutesLeft);
end else
begin
eStatus.Color := clRed;
eStatus.Text := 'UNUSED';
end;
end;
Show/Hide C++ function example
#include "include/enigma_api.h"
#pragma link "include/enigma_ide.lib"
void __fastcall TfrmMain::tmTimerTimer(TObject *Sender)
{
_SYSTEMTIME lpSystemTime;
unsigned long dwTotal;
unsigned long dwLeft;
GetSystemTime(&lpSystemTime);
eGlobalTime->Text = Format("%.2d:%.2d:%.2d", ARRAYOFCONST((lpSystemTime.wHour, lpSystemTime.wMinute, lpSystemTime.wSecond)));
dwCounter += tmTimer->Interval;
eExecutionTime->Text = Format("%.2d:%.2d:%.2d",
ARRAYOFCONST((
dwCounter / (60 * 60 * 1000) % 24,
dwCounter / (60 * 1000) % 60,
dwCounter / 1000 % 60
)));
if (EP_TrialExecutionTime(&dwTotal, &dwLeft))
{
Label2->Caption = Format("%d", ARRAYOFCONST(((int)dwTotal)));
Label3->Caption = Format("%d", ARRAYOFCONST(((int)dwLeft)));
pbTrial->Max = (int)dwTotal;
pbTrial->Position = (int)dwLeft;
eStatus->Text = "OK";
eStatus->Color = clGreen;
} else
{
eStatus->Text = "UNUSED";
eStatus->Color = clRed;
}
}
See function examples in the installation folder, Examples\TrialExecutionTime subfolder.