Professional Edition Only

Programming with SafeHouse

All of the standard SafeHouse utility wizards support being run from batch files (.BAT), Windows Scripting Host scripts (.VBS),  Windows NT command files (.CMD) and custom-designed C++ or Visual Basic applications. In any of these environments, the wizards can be instructed to display fully- or partially-completed dialogs, or to not display any user interface at all and to perform their tasks silently without a window.

You can specify how you want the utilities to behave by using command line options. Each utility has its own set of options. Please refer to the reference section for the individual utilities to determine which command line options apply to specific utilities.

SafeHouse Utilities Designed for Scripting

The following executables found in the SafeHouse program files folder support a rich set of command line options that are so complete that you can practically do anything through scripting that you can otherwise do from the standard SafeHouse dialogs. This includes creating new volumes, opening and closing volumes, as well as resizing them.


TIP: Running the SafeHouse utilities silently without a window requires using the /SILENT and /GO command line options in addition to the usual parameters required by each utility. When you specify these options and are not missing any other required options, the SafeHouse utilities will not display and visual user interface.

Process Exit Codes

The SafeHouse utilities are designed to return a variety of process exit codes. These codes allow custom-created applications to silently perform a SafeHouse task and receive a return value indicating the success or failure status of the operation. Unfortunately, these codes are not available when using batch files or Windows Scripting Host scripts. To gain access to the process exit codes, you'll need to either directly call the applicable Windows C++ functions, or you can use the included SafeHouse ActiveX component.

See SafeHouse Exit Codes for a complete list of codes.

ActiveX Component

SafeHouse includes a simple ActiveX component which is registered with Windows when the product is installed. This component allows you to easily call the various SafeHouse utilities from Visual Basic, C++, .Net and other ActiveX-aware programming environments. Using this component, you can also get a list of the drive letters and volume filepaths currently being used by SafeHouse.

See SafeHouse ActiveX Component for more information.

Calling SafeHouse from C++

SafeHouse's executables can easily be called from C++ using standard programming tools such as Visual C++ from Microsoft.

Below is a very simple example of how to call SafeHouse from C++. The program takes a single command line argument which is the filepath to one of the SafeHouse utilities to run. The Windows CreateProcess() function is called to execute the utility and then the program waits for the process to terminate before retrieving and printing the process exit code.

The sample program below could be called to close all open SafeHouse volumes using the following command line.

C:\> SAMPLE.EXE "c:\SafeHouse\Program Files\SDWMAP32.EXE /unmap=all /silent /go"

C++ Programming Example

#include <stdio.h>

#include <stdlib.h>

#include <time.h>

#include <string.h>

#include <windows.h>


int main(int argc, char *argv[])


LPSTR cmdline, cmdargs;  

cmdline = GetCommandLine(); // program to run is specified on the command line


if (argc > 1 &&  (cmdargs = strstr(cmdline, argv[1])) != NULL)


printf("Executing command: %s\n", cmdargs);





StartupInfo.cb = sizeof(StartupInfo);

DWORD dwExitCode;


if (CreateProcess(

NULL, // application to run defaults to using command line

cmdargs, // command line args

NULL, // process attributes, cannot be inherited.

NULL, // thread atribs, cannot be inherited

FALSE, // new process does not inherit any handles from us


NULL, // default environment

NULL, // current directory is same as ours




printf("Waiting for process to terminate...\n");


WaitForSingleObject(ProcessInfo.hProcess, INFINITE );

GetExitCodeProcess(ProcessInfo.hProcess, &dwExitCode);





printf("\nProcess Exit Code: %d\n", dwExitCode);



printf ("Create Process failed with error code %d.\n", GetLastError());



printf ("Invalid command line parameters.\n");


return (0);



file protection  encrypted usb  Compare to Kaspersky  folder lock  folder security