Jump to content

WinStartApp: Difference between revisions

From EDM2
m add link for PROGDETAILS data type
 
(11 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== WinStartApp ==
; WinStartApp(notifyHndl, progDetails, progParams, reserved, flags) :
Execute a program.
Execute a program.
== Syntax ==
WinStartApp (notifyHndl, progDetails, progParams, reserved, flags)


=== Parameters ===
=== Parameters ===
; notifyHndl - [[OS2 API:DataType:HWND|HWND]] - input :
; notifyHndl - [[HWND]] - input : The window notification handle or [[NULLHANDLE]]. If a window handle is passed, the system passes the WM_APPTERMINATENOTIFY message upon program exit.
The window notification handle or [[OS2 API:DataType:NULLHANDLE|NULLHANDLE]]. If a window handle is passed, the system passes the [[OS2_API:Constant:WM#WM_APPTERMINATENOTIFY|WM_APPTERMINATENOTIFY]] message upon program exit.
; progDetails - PROGDETAILS - input : The program list structure.
 
; progParams - [[PSZ]] - input : [[NULL]] or the parameters for the program to be started. The layout is first, the program's exe name; the second, the space separated arguments.
; progDetails - [[OS2 API:DataType:PROGDETAILS|PROGDETAILS]] - input :
; reserved - [[PVOID]] - input : Start data. Reserved - pass NULL.
The program list structure.
; flags - [[ULONG]] - input : Zero for no flags or:
 
* [[SAF#SAF_BACKGROUND|SAF_BACKGROUND]]
; progParams - [[OS2 API:DataType:PSZ|PSZ]] - input :
* [[SAF#SAF_INSTALLEDCMDLINE|SAF_INSTALLEDCMDLINE]]
[[OS2 API:Constant:NULL|NULL]] or the parameters for the program to be started. The layout is first, the program's exe name; the second, the space separated arguments.
* [[SAF#SAF_MAXIMIZED|SAF_MAXIMIZED]]
 
* [[SAF#SAF_MINIMIZED|SAF_MINIMIZED]]
; reserved - [[OS2 API:DataType:PVOID|PVOID]] - input :
* [[SAF#SAF_STARTCHILDAPP|SAF_STARTCHILDAPP]]
Start data. Reserved - pass [[OS2 API:Constant:NULL|NULL]].
 
; flags - [[OS2 API:DataType:ULONG|ULONG]] - input :
Zero for no flags or:
* [[OS2 API:Constant:SAF#SAF_BACKGROUND|SAF_BACKGROUND]]
* [[OS2 API:Constant:SAF#SAF_INSTALLEDCMDLINE|SAF_INSTALLEDCMDLINE]]
* [[OS2 API:Constant:SAF#SAF_MAXIMIZED|SAF_MAXIMIZED]]
* [[OS2 API:Constant:SAF#SAF_MINIMIZED|SAF_MINIMIZED]]
* [[OS2 API:Constant:SAF#SAF_STARTCHILDAPP|SAF_STARTCHILDAPP]]


=== Constants ===
=== Constants ===
Line 28: Line 20:


=== Returns ===
=== Returns ===
The invoked applications handle of type [[OS2_API:DataType:HAPP|HAPP]], or [[OS2_API:DataType:NULLHANDLE|NULLHANDLE]] if an error occurred.
;[[HAPP]] : The invoked applications handle of this type.
Possible returns from [[OS2 API:WinGetLastError|WinGetLastError]]:
;[[NULLHANDLE]] : An error occurred.
* [[OS2 API:PMI:error#PMERR_CANNOT_START|PMERR_CANNOT_START]]
Possible returns from [[WinGetLastError]]:
* [[OS2 API:PMI:error#PMERR_INVALID_APPL|PMERR_INVALID_APPL]]
* [[PM Error Codes#PMERR_CANNOT_START|PMERR_CANNOT_START]]
* [[OS2 API:PMI:error#PMERR_INVALID_HWND|PMERR_INVALID_HWND]]
* [[PM Error Codes#PMERR_DOS_ERROR|PMERR_DOS_ERROR]]
* [[OS2_API:PMI:error#PMERR_INVALID_PROGRAM_CATEGORY|PMERR_INVALID_PROGRAM_CATEGORY]]
* [[PM Error Codes#PMERR_INVALID_APPL|PMERR_INVALID_APPL]]
 
* [[PM Error Codes#PMERR_INVALID_HWND|PMERR_INVALID_HWND]]
=== Module ===
* [[PM Error Codes#PMERR_INVALID_PARAMETERS|PMERR_INVALID_PARAMETERS]]
* [[PM Error Codes#PMERR_INVALID_PROGRAM_CATEGORY|PMERR_INVALID_PROGRAM_CATEGORY]]
* [[PM Error Codes#PMERR_INVALID_WINDOW|PMERR_INVALID_WINDOW]]
* [[PM Error Codes#PMERR_STARTED_IN_BACKGROUND|PMERR_STARTED_IN_BACKGROUND]]


=== Define (C/C++) ===
=== Define (C/C++) ===
INCL_WINWINDOWMGR or INCL_WIN or INCL_PM
INCL_WINWINDOWMGR or INCL_WIN or INCL_PM


=== Export name/Ordinal ===
=== Calling Convention ===
 
=== Calling conversion ===
[[Cdecl32]]
[[Cdecl32]]


=== Example Code ===
=== Example Code ===
  [[OS2 API:DataType:HWND|HWND]]       notifyHndl;
  HWND        notifyHndl;
  [[OS2 API:DataType:PROGDETAILS|PROGDETAILS]] progDetails;
  PROGDETAILS progDetails;
  [[OS2 API:DataType:PSZ|PSZ]]         progParams;
  PSZ        progParams;
  [[OS2 API:DataType:PVOID|PVOID]]       reserved = [[OS2_API:Constant:NULL|NULL]];
  PVOID      reserved = NULL;
  [[OS2 API:DataType:ULONG|ULONG]]       flags;
  ULONG      flags;
  [[OS2 API:DataType:HAPP|HAPP]]       invokedHndl;
  HAPP        invokedHndl;
...
// populate PROGDETAILS structure...
  ...
  ...
  invokedHndl = WinStartApp(notifyHndl, progDetails, progParams, reserved, flags);
  invokedHndl = WinStartApp(notifyHndl, progDetails, progParams, reserved, flags);
Line 57: Line 52:


=== Related Functions ===
=== Related Functions ===
[[OS2 API:WinTerminateApp|WinTerminateApp]]
*[[WinQueryTaskSizePos]]
*[[WinSetWindowPos]]
*[[WinTerminateApp]]


=== Notes ===
=== Notes ===
Specifying [[SAF#SAF_STARTCHILDAPP|SAF_STARTCHILDAPP]] flag, the newly invoked program can be stopped with [[WinTerminateApp]].


=== OS Version Introduced ===
[[Category:Win]]

Latest revision as of 21:52, 6 August 2023

Execute a program.

Syntax

WinStartApp (notifyHndl, progDetails, progParams, reserved, flags)

Parameters

notifyHndl - HWND - input
The window notification handle or NULLHANDLE. If a window handle is passed, the system passes the WM_APPTERMINATENOTIFY message upon program exit.
progDetails - PROGDETAILS - input
The program list structure.
progParams - PSZ - input
NULL or the parameters for the program to be started. The layout is first, the program's exe name; the second, the space separated arguments.
reserved - PVOID - input
Start data. Reserved - pass NULL.
flags - ULONG - input
Zero for no flags or:

Constants

None

Returns

HAPP
The invoked applications handle of this type.
NULLHANDLE
An error occurred.

Possible returns from WinGetLastError:

Define (C/C++)

INCL_WINWINDOWMGR or INCL_WIN or INCL_PM

Calling Convention

Cdecl32

Example Code

HWND        notifyHndl;
PROGDETAILS progDetails;
PSZ         progParams;
PVOID       reserved = NULL;
ULONG       flags;
HAPP        invokedHndl;
...
// populate PROGDETAILS structure...
...
invokedHndl = WinStartApp(notifyHndl, progDetails, progParams, reserved, flags);
...

Related Functions

Notes

Specifying SAF_STARTCHILDAPP flag, the newly invoked program can be stopped with WinTerminateApp.