This method retrieves the number of months that remain before the application is locked.

[Visual Basic] Public Function QueryRemainMonths() As Integer
[C#] public int QueryRemainMonths();

Return Value

A. If the QueryProtect method returns a value of 0 (Unlocked), this method will return the number of months remaining. If a password (with no expiration) has been generated and used to unlock the application, this method will return -1.

B. If the QueryProtect method returns a value of 1 (Locked), this method will return -1 (a password with an expiration has been used and the number of months has been exceeded.)

C. If the QueryProtect method returns a value of 4 (The number of months has been exceeded), this method returns the number of exceeded months. (For example: if the number of months has been exceeded by 3, the return value of this method is -3).

D. If the QueryProtect method returns a value other than the values mentioned in A, B, or C above, this method returns -1.

Explanation

The QueryRemainMonths method retrieves the number of months that remain before the application is locked. When using "Number of Months" protection, this method will return the number of days remaining. For all other types of protection, this method will return -1.

The Initialize method must be executed before executing the QueryRemainMonths method. If the Initialize method has not been successfully executed, the QueryRemainMonths method is disabled.

Also See

PasswordProtect Members | Newtone.ProtectKit.Win.PasswordProtect