Sometimes you may need a computer with a single application running on it, and with all other applications and resources hidden from users. An example, Indigo Book Store customers can only search books when using public computers in the store.
The following items should be concealed:
Windows Taskbar and Start Menu
both Windows keys
right click on the Windows Desktop
all icons on the desktop
An article Lock Windows Desktop written by Antσnio Feijγo describes several techniques of restricting users from accessing the desktop and running other applications.
The one that switches to a new desktop seems to be efficient, easy to understand and can be accomplished in just FoxPro code with no external libraries other than WinAPI.
Use the following code to test the AppLauncher class:
LOCAL obj, ex As Exception
obj = CREATEOBJECT("AppLauncher")
"C:\Program Files\Internet Explorer\iexplore.exe",;
IF .errorno <> 0
? .errorno, .message
CATCH TO ex
? ex.ErrorNo, ex.Message
An Internet Explorer window will appear inside a new desktop. ALT+TAB, CTRL+ESC and CTRL+ALT+DEL keys are disabled. The Windows Taskbar and Start Menu are not visible. Close IE window to get back to the default Windows Desktop.
To implement this technique, create a launcher -- a small VFP application that starts the main executable by calling the CreateProcess API function.
Name of the new desktop is assigned to lpDesktop member of the STARTUPINFO structure that used with the CreateProcess call. As the result, the main application runs inside a separate desktop, which is absolutely empty.
The WaitForSingleObject function returns, when the main application is closed by user. Also this function returns when the time-out interval elapses, unless dwMilliseconds is INFINITE.
* * *
A window station is a securable object that is associated with a process, and contains a clipboard, an atom table, and one or more desktop objects.
The interactive window station, WinSta0, is the only window station that can display a user interface or receive user input. It is assigned to the logon session of the interactive user, and contains the keyboard, mouse, and display device. All other window stations are noninteractive, which means they cannot display a user interface or receive user input.
A desktop is a securable object contained within a window station. A desktop has a logical display surface and contains user interface objects such as windows, menus, and hooks.
* * *
C++ code shows how to enumerate window stations and window desktops. The enumerations are based on callback functions and for that reason can not be programmed directly in VFP code.