OS_ShellExecute

<< Click to Display Table of Contents >>

Navigation:  ThinBASIC Modules > OS (Operating System) >

OS_ShellExecute

 

Description

 

Performs an operation on a specified file.

The function opens or prints a specified file.

The file can be an executable file or a document file.

 

Syntax

 

hInstance = OS_ShellExecute(Operation, File, Parameters, Directory, ShowCmd)

 

Returns

 

If the function succeeds, it returns a value greater than 32. If the function fails, it returns an error value that indicates the cause of the failure. The return value is cast as an HINSTANCE for backward compatibility with 16-bit Windows applications. It is not a true HINSTANCE, however.

 

Parameters

 

Name

Type

Optional

Meaning

Operation

String

No

A string specifying the operation to perform. This string can be "open" or "print".

File

String

No

A string specifying the file to open

Parameters

String

No

A string specifying parameters passed to the application when the File parameter specifies an executable file. If File is a string specifying a document file, this parameter is an empty string.

Directory

String

No

a string specifying the default directory.

ShowCmd



One of the following equates:

%SW_HIDE

Hides the window and passes activation to another window.

%SW_SHOWNORMAL

Activates and displays a window. If the window is minimized or maximized, Windows restores it to its original size and position (same as 9).

%SW_NORMAL

Activates and displays a window. If the window is minimized or maximized, Windows restores it to its original size and position (same as 9).

%SW_SHOWMINIMIZED

Activates a window and displays it as an icon.

%SW_SHOWMAXIMIZED

Activates a window and displays it as a maximized window.

%SW_MAXIMIZE

Activates a window and displays it as a maximized window.

%SW_SHOWNOACTIVATE

Displays a window in its most recent size and position. The window that is currently active remains active.

%SW_SHOW

Activates a window and displays it in its current size and position.

%SW_MINIMIZE

Minimizes the specified window and activates the top-level window in the system's list.

%SW_SHOWMINNOACTIVE

Displays a window as an icon. The window that is currently active remains active.

%SW_SHOWNA

Displays a window in its current state. The window that is currently active remains active.

%SW_RESTORE

Activates and displays a window. If the window is minimized or maximized, Windows restores it to its original size and position (same as 1).

%SW_SHOWDEFAULT

Sets the show state based on parameters  specified by the program that started the application

 

 

Remarks

 

More info can be found at: http://msdn.microsoft.com/en-us/library/bb762153(v=vs.85).aspx

 

Restrictions

 

Please consider OS_Shell function for executing process synchronously or asynchronously.

 

See also

 

Windows API reference, OS_Shell

 

Examples