|Did you know ...||Search Documentation:|
|Windows-specific Operating System Interaction|
The predicates in this section are only available on the Windows version of SWI-Prolog. Their use is discouraged if there are portable alternatives. For example, win_exec/2 and win_shell/2 can often be replaced by the more portable shell/2 or the more powerful process_create/3.
SW_*constants written in lowercase without the
shownormal. In addition,
iconicis a synonym for
exploreor another operation registered with the shell for the given document type. On modern systems it is also possible to pass a URL as File, opening the URL in Windows default browser. This call interfaces to the Win32 API ShellExecute(). The Show argument determines the initial state of the opened window (if any). See win_exec/2 for defined values.
win_shell(Operation, File, normal).
DWORD, the value is returned as an integer. If the value is a string, it is returned as a Prolog atom. Other types are currently not supported. The default‘root' is
HKEY_CURRENT_USER. Other roots can be specified explicitly as
HKEY_USERS. The example below fetches the extension to use for Prolog files (see
README.TXTon the Windows version):
?- win_registry_get_value( 'HKEY_LOCAL_MACHINE/Software/SWI/Prolog', fileExtension, Ext). Ext = pl
CSIDL_and mapping the constant to lowercase. Check the Windows documentation for the function SHGetSpecialFolderPath() for a description of the defined constants. This example extracts the‘My Documents' folder:
?- win_folder(personal, MyDocuments). MyDocuments = 'C:/Documents and Settings/jan/My Documents'
%PATH%is extended with the provided directory. AbsDir may be specified in the Prolog canonical syntax. See prolog_to_os_filename/2. Note that use_foreign_library/1 passes an absolute path to the DLL if the destination DLL can be located from the specification using absolute_file_name/3. This predicate is available from library
library(shlib)and can be autoloaded.
is passed an absolute path to a DLL on a Windows installation
that supports AddDllDirectory() and friends,146Windows 7
with up-to-date patches or Windows 8. SWI-Prolog uses
LoadLibraryEx() with the flags
LOAD_LIBRARY_SEARCH_DEFAULT_DIRS. In this scenario,
%PATH% are not searched.
Additional directories can be added using win_add_dll_directory/2.
name, the list elements are atoms. See Language Names for details. If Format is
id, Languages is a list of numeric language ids represented as Prolog integers. This predicate provides Windows alternative to setlocale/3 using the category