Jump to content

WinWaitForShell: Difference between revisions

From EDM2
Ak120 (talk | contribs)
No edit summary
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== WinWaitForShell ==
Allows an application to wait for the Workplace Shell to become available.
;WinWaitForShell(event) : Allows an application to wait for the Workplace Shell to become available.
 
WinWaitForShell determines if various events in the Workplace Shell(R) have taken place.


==Syntax==
==Syntax==
<PRE>
  WinWaitForShell (ulEvent)
#define
#include <os2.h>
 
  BOOL EXPENTRY WinWaitForShell (ULONG ulEvent)  
</PRE>
 
=== Parameters ===
;ulEvent (ULONG) input : ulEvent has the following flags which indicate which event is to be queried. One, and only one, of these flags must be turned on.


Constants defined for event:
==Parameters==
;''ulEvent'' ([[ULONG]]) - input : ulEvent has the following flags which indicate which event is to be queried. One, and only one, of these flags must be turned on.


* [[WWFS|WWFS_QUERY]] - Query if the event has taken place. If this flag is not turned on then this call will block until the event has taken place.  
[[WWFS|Constants]] defined for event:
* [[WWFS|WWFS_DESKTOPCREATED]] - Desktop has been created.
*WWFS_QUERY - Query if the event has taken place. If this flag is not turned on then this call will block until the event has taken place.
* [[WWFS|WWFS_DESKTOPOPENED]] - A view of the Desktop has been opened.
*WWFS_DESKTOPCREATED - Desktop has been created.
* [[WWFS|WWFS_DESKTOPPOPULATED]] - The desktop has been populated.
*WWFS_DESKTOPOPENED - A view of the Desktop has been opened.
*WWFS_DESKTOPPOPULATED - The desktop has been populated.


=== Returns ===
==Returns==
Returns [[BOOL]] with the values of:
Returns [[BOOL]] with the values of:
*[[TRUE]] - Event has taken place.
*[[TRUE]] - Event has taken place.
Line 26: Line 21:
*PMERR_INVALID_PARAMETER (0x1208) - One of the defined WWFS_DESKTOP* flags was not passed in ulEvent.
*PMERR_INVALID_PARAMETER (0x1208) - One of the defined WWFS_DESKTOP* flags was not passed in ulEvent.


=== Define (C/C++) ===
== Export name/Ordinal ==
INCL_WINWORKPLACE
 
=== Export name/Ordinal ===
Exported as ordinal 512 from PMWP.DLL.
Exported as ordinal 512 from PMWP.DLL.


=== Calling conversion ===
== Calling Convention ==
[[Cdecl32]]
[[Cdecl32]]


=== Example Code ===
== Notes ==
BOOL rc;
When calling ''WinWaitForShell'' from processes started by a RUN= statement in config.sys, you must specify the WWFS_QUERY flag. Else the call will fail.
...
rc = WinWaitForShell(WWFS_DESKTOPPOPULATED); // Desktop populated
...


=== Related Functions ===
A message queue is not required for the thread which calls ''WinWaitForShell''.
*[[WinNotebookButtonFromID]]
 
The prototype and defines for this function are defined in wpobject.h, which may be inaccessible if not compiling a WPS object class. Copy the defines and the prototype verbatim into your own code or headers for use. It is exported through os2386.lib in the OS/2 Warp 4 Toolkit.


=== Notes ===
==Remarks==
When calling '''WinWaitForShell''' from processes started by a RUN= statement in config.sys, you must specify the WWFS_QUERY flag. Else the call will fail.
This function can be used to either determine if a Workpalce Shell event has taken place or wait until that event has taken place. Set ulEvent to one of the WWFS_DESKTOP* #defines above.


A message queue is not required for the thread which calls '''WinWaitForShell'''.
To block until the event has occurred, do not turn on the WWFS_QUERY flag.


The prototype and defines for this function are defined in wpobject.h, which may be inaccessible if not compiling a WPS object class. Copy the defines and the prototype verbatim into your own code or headers for use. It is exported through os2386.lib in the OS/2 Warp 4 Toolkit.
Simply to query if the event has occurred and not to wait for it to occur, turn on the WWFS_QUERY flag.  


=== OS Version Introduced ===
== OS Version Introduced ==
OS/2 Warp 4
OS/2 Warp 4


=== Implementation details ===
== Implementation details ==
This function queries or waits for three event semaphores created by [[WinStartShell]] during WPS bootup. These events are:
This function queries or waits for three event semaphores created by ''WinStartShell'' during WPS bootup. These events are:
  \\SEM32\\WORKPLAC\\SHELL1WT.SEM
  \\SEM32\\WORKPLAC\\SHELL1WT.SEM
  \\SEM32\\WORKPLAC\\SHELL2WT.SEM
  \\SEM32\\WORKPLAC\\SHELL2WT.SEM
  \\SEM32\\WORKPLAC\\SHELL3WT.SEM
  \\SEM32\\WORKPLAC\\SHELL3WT.SEM
Each according to the three WWFS constants. Calling ''WinWaitForShell'' before the second instance of PMShell is started is valid as long as the WWFS_QUERY bit is specified.


Each according to the three [[WWFS|WWFS-constants]]. Calling '''WinWaitForShell''' before the second instance of PMShell is started is valid as long as the [[WWFS|WWFS_QUERY]] bit is specified.
Once posted, the events are not reset again, so to be able to wait for the shell to come back up after resetting it programmatically, the events must be reset by the calling process. Reset the events right before killing WPS, not before calling ''WinWaitForShell''.
 
Once posted, the events are not reset again, so to be able to wait for the shell to come back up after resetting it programmatically, the events must be reset by the calling process. Reset the events right before killing WPS, not before calling '''WinWaitForShell'''.


==Example Code==
==Example Code==
This example checks (non-blocking) to see if the Workplalce Shell Desktop to be populated has been populated or not.
Definition:
<PRE>
<pre>
#define
#define
#include  <os2.h>
#include  <os2.h>


BOOL fOccurred;
    BOOL EXPENTRY WinWaitForShell(ULONG ulEvent)
</pre>


fOccurred + WinWaitForShell(WWFS_DESKTOPPOPULATED | WWFS_QUERY);
This example checks (non-blocking) to see if the Workplace Shell Desktop to be populated has been populated or not.
if (fOccurred)
<pre>
#define  INCL_WINWORKPLACE
#include <os2.h>
BOOL fOccurred;
fOccurred + WinWaitForShell(WWFS_DESKTOPPOPULATED | WWFS_QUERY);
if (fOccurred)
   {
   {
     /* The Desktop has been populated */
     /* The Desktop has been populated */
   }
   }
else
else
   {
   {
     /* The Desktop has not been populated */
     /* The Desktop has not been populated */
</PRE>
</pre>
==Related Functions==
*[[WinNotebookButtonFromID]]


[[Category:Win]]
[[Category:Win]]

Latest revision as of 03:57, 16 May 2025

Allows an application to wait for the Workplace Shell to become available.

WinWaitForShell determines if various events in the Workplace Shell(R) have taken place.

Syntax

WinWaitForShell (ulEvent)

Parameters

ulEvent (ULONG) - input
ulEvent has the following flags which indicate which event is to be queried. One, and only one, of these flags must be turned on.

Constants defined for event:

  • WWFS_QUERY - Query if the event has taken place. If this flag is not turned on then this call will block until the event has taken place.
  • WWFS_DESKTOPCREATED - Desktop has been created.
  • WWFS_DESKTOPOPENED - A view of the Desktop has been opened.
  • WWFS_DESKTOPPOPULATED - The desktop has been populated.

Returns

Returns BOOL with the values of:

  • TRUE - Event has taken place.
  • FALSE - Event has not taken place.
  • PMERR_INVALID_PARAMETER (0x1208) - One of the defined WWFS_DESKTOP* flags was not passed in ulEvent.

Export name/Ordinal

Exported as ordinal 512 from PMWP.DLL.

Calling Convention

Cdecl32

Notes

When calling WinWaitForShell from processes started by a RUN= statement in config.sys, you must specify the WWFS_QUERY flag. Else the call will fail.

A message queue is not required for the thread which calls WinWaitForShell.

The prototype and defines for this function are defined in wpobject.h, which may be inaccessible if not compiling a WPS object class. Copy the defines and the prototype verbatim into your own code or headers for use. It is exported through os2386.lib in the OS/2 Warp 4 Toolkit.

Remarks

This function can be used to either determine if a Workpalce Shell event has taken place or wait until that event has taken place. Set ulEvent to one of the WWFS_DESKTOP* #defines above.

To block until the event has occurred, do not turn on the WWFS_QUERY flag.

Simply to query if the event has occurred and not to wait for it to occur, turn on the WWFS_QUERY flag.

OS Version Introduced

OS/2 Warp 4

Implementation details

This function queries or waits for three event semaphores created by WinStartShell during WPS bootup. These events are:

\\SEM32\\WORKPLAC\\SHELL1WT.SEM
\\SEM32\\WORKPLAC\\SHELL2WT.SEM
\\SEM32\\WORKPLAC\\SHELL3WT.SEM

Each according to the three WWFS constants. Calling WinWaitForShell before the second instance of PMShell is started is valid as long as the WWFS_QUERY bit is specified.

Once posted, the events are not reset again, so to be able to wait for the shell to come back up after resetting it programmatically, the events must be reset by the calling process. Reset the events right before killing WPS, not before calling WinWaitForShell.

Example Code

Definition:

#define
#include  <os2.h>

    BOOL EXPENTRY WinWaitForShell(ULONG ulEvent) 

This example checks (non-blocking) to see if the Workplace Shell Desktop to be populated has been populated or not.

 #define  INCL_WINWORKPLACE
 #include <os2.h>
 
 BOOL fOccurred;
 
 fOccurred + WinWaitForShell(WWFS_DESKTOPPOPULATED | WWFS_QUERY);
 if (fOccurred)
   {
    /* The Desktop has been populated */
   }
 else
   {
    /* The Desktop has not been populated */

Related Functions