How to prompt for a password for closing ebook?

I want to prompt for a password for allowing users to close my ebook. How can I do that?

Just follow these steps:

1) Open your HTML Executable project and go to the Script Manager. Double-click the “UserMain” script to open the script editor.

2) Replace the existing OnWindowCloseQuery block code by the following code:

function OnWindowCloseQuery(WindowName: String): Boolean;
 S: String;
 // Occurs when the user wants to close the window.
 // Note: set to False if you do not want to close the window.
 S := InputBox("To exit, please enter the password", "Security", "");
 Result := S = "OurPassword"; // replace OurPassword by what you want. Do not remove quotes.

3) Click Save Script.

Compile your project and that’s all.

Note that the ebook will be automatically closed without password if the user shuts down his computer.

Introduction to Scripting

Using the Script Manager

Script Function Reference

Copyright G.D.G. Software 2019. All rights reserved