Home

Advanced Topics

Function bar

Starting with version 8.0, Desktop Lock does not present "Leave a message" and "Shut down computer" windows directly on the locked desktop. This change addresses feedback from users who preferred these windows not interrupt the layout, while still requiring access to these features.

Desktop Lock now utilizes a function bar located at the top of the locked desktop to provide access for leaving messages and/or shutting down the computer.

The function bar is visible only when one or both of the following advanced options are enabled:

  • Allow leaving messages while locked
  • Allow computer to be shut down while locked

The function bar automatically collapses into a thin line at the top of the main screen, appearing whenever the mouse cursor moves toward it. Users may click the relevant icons on the function bar to leave messages or to shut down the computer.

Run app considerations

To ensure the lock mode "App" functions as intended, Desktop Lock needs to handle various edge cases.

Pick an existing instance rather than consistently restarting new

Certain applications, such as web browsers like Chrome and Firefox, function by launching a new instance when a user opens an HTML file; this new instance then sends a request to an already active instance to open the file before closing itself. In these scenarios, Desktop Lock should identify and connect to an existing browser instance rather than attempting to re-launch the HTML document.

Failure to implement this approach may result in an infinite loop caused by the continuous reopening of the document.

Standard programs will also be impacted by this behavior. For example, if Notepad is already active and Desktop Lock is configured to launch a specific text document, the document will open correctly via a new Notepad instance. However, if the user subsequently closes that document, Desktop Lock may pick the old running Notepad instance instead of reopening the document. The concern is that the existing Notepad instance could contain any open file, not necessarily the one specified in Desktop Lock.

Avoid infinite loops by handling app launchers (redirectors)

Certain system programs function solely as launchers or redirectors; they initiate other processes and terminate immediately upon execution. For instance, calc.exe (Windows Calculator) will launch "win32calc.exe" or "Calculator.exe".

Unlike the previous scenario, there will be no running instances of calc.exe to be picked by Desktop Lock, as launchers do not remain running. They consistently exit once the subsequent programs have been started.

In the case of a launcher like calc.exe, Desktop Lock will consistently fail to pick a running instance of it. If Desktop Lock attempts to reopen it without any check, an infinite loop will inevitably occur, resulting in numerous Windows Calculators appearing on your desktop until resources are exhausted and the system crashes.

Desktop Lock is designed to manage this situation to prevent infinite loops, but it is advisable to ⏵ test the specified program first to ensure it can start successfully on the locked desktop. Alternatively, you may use the target icon to capture the correct program name from a running instance.

Certain programs and documents are not supported

Specific file types cannot be opened by Desktop Lock and should not be selected as the document for the "App" lock mode. Examples include .lnk, .url, and .cab.

Desktop Lock is capable of launching nearly all programs (.exe), including those that require administrator permissions, with the exception of a few particular system programs such as osk.exe (On-Screen Keyboard).

Command line switches

You can use command line switches for various tasks, such as backing up and restoring configurations, locking the system in a scheduled task as an alternative to the Desktop Lock schedule setting, or even unlocking the system via command line.

Additionally, certain options that lack corresponding controls within the user interface can be adjusted through the command line.

The standard format for a command line switch is /switch value. Each switch begins with a forward slash (/) and can have one or more optional values.

If a value includes space characters, it must be enclosed in quotation marks, e.g., /backup "D:\My File.dat". Values may also be quoted even when they do not contain spaces. If you need to use quotation marks within a value, please escape them using a backslash, e.g., /pwd "ab \"c\"".

Assuming Desktop Lock is installed in its default directory, a typical example is:

"C:\Program Files\Desktop Lock\DeskLock.exe" /Backup D:\dlbk.dat /pwd "abc"

List of command line switches:

  • /pwd admin_password

    Numerous other switches require the admin password via this parameter, enabling Desktop Lock to verify that the command is from the authorized user.

  • /Lock

    Lock the system with current configuration. The switch has no value, and does not need to provide admin password.

  • /Unlock

    Unlock the system. The switch has no value, but the correct admin password must be supplied with /pwd.

  • /Backup file

    Back up current configuration to the designated file. The file should be in full path, and admin password must be provided.

  • /Restore file

    Restore a configuration backup file to be current configuration. The file should be in full path, and admin password must be provided.

  • /resetcfg

    Reset the configuration to default.The switch has no value, but the correct admin password must be supplied with /pwd.

  • /advsdcd def|[0-65535]

    This switch configures the countdown duration for the "shut down computer" window. You may use the value "def" to restore the default countdown, or specify any value within the range. Setting the value to 0 disables the countdown, which causes clicking the "shut down computer" icon on the function bar to initiate an immediate system shutdown.

  • /advifmf def|0|1|2

    This switch modifies a hidden option regarding the display of background images on locked desktops for systems equipped with multiple monitors.

    This hidden option has no effect if the system has only one single monitor attached.

    By default, Desktop Lock displays the background image on each monitor individually, with the exception of the image fit mode Span, which treats all monitors as a single continuous surface. This switch allows you to restrict the background image to the main monitor or to ensure all monitors are treated as a single surface across all fit modes.

    Use value "def" or 0 to set to the default behavior; 1 to treat all monitors as a single surface; or 2 to display the image only on the main monitor.

Notes regarding the switches "/backup", "/restore", and "/resetcfg":
  • The configuration includes all settings in "Desktop Lock Settings" window, as well as the hidden options modifiable via "/advsdcd" and "/advifmf". It doesn't include settings related to theme, font, and language.
  • Regarding the switch "/restore", the admin password supplied by /pwd must correspond to the admin password of the current configuration, rather than that of the backup file.

Create a "Lock Now" shortcut icon on your desktop

  1. Right-click an empty area of your desktop, then select "New" followed by "Shortcut" from the context menu.
  2. Enter the following command line into the designated field:

    "C:\Program Files\Desktop Lock\DeskLock.exe" /Lock

    And click Next to continue.

  3. Enter the name "Lock Now" in the text box, and click Finish to complete the creation of the shortcut.

Back up and restore configuration

To back up current configuration to a file:

"C:\Program Files\Desktop Lock\DeskLock.exe" /backup D:\dlbk.dat /pwd "admin password"

To restore a configuration backup to be current configuration:

"C:\Program Files\Desktop Lock\DeskLock.exe" /restore D:\dlbk.dat /pwd "admin password"

As noted previously, when restoring a configuration, the admin password specified via "/pwd" must match the password within the current configuration, rather than the password contained in the backup file.

Reset configuration to default

"C:\Program Files\Desktop Lock\DeskLock.exe" /resetcfg /pwd "admin password"

Prevent Desktop Lock kernel from running in the background

The primary executable, DeskLock.exe, serves several functions. It acts as the control program for configuring Desktop Lock, functions as the kernel component responsible for locking the system, and handles other features such as lock hotkeys, scheduling, etc.

The kernel component will refrain from running in the background when its presence is not required.

However, if you have configured a lock hotkey, enabled the schedule, or set Desktop Lock to auto-lock during system idle time, the kernel component must remain active in the background to handle these specific features.

The software is carefully designed to utilize minimal system resources, ensuring that background operation does not impact system performance. But if you prefer to keep it from running in the background, please verify the following configurations: