WinInitialize: Difference between revisions
(8 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
Initializes the PM facilities to be used by an application. | |||
==Syntax== | |||
WinInitialize(flOptions) | |||
==Usage Explanation== | |||
This function must be the first PM function called by any application thread intending to use PM or GPI services. The return value is sometimes needed by other functions and should be saved. [[WinTerminate]] can be called if a thread no longer needs these services. This API can only be called once per thread. | |||
===Parameters=== | |||
;flOptions (ULONG) - input | |||
:Initialization options. | |||
:The initial state for newly created windows is that all messages for the window are available for processing by the application. | |||
:This is the only option available in PM. | |||
===Returns=== | |||
; hab (HAB) - returns | |||
:Anchor-block handle. This return value is a handle to an anchor block. The anchor block is a structure which is used by OS/2 to keep track of application specific error information, and the handle is needed for certain other PM functions, such as [[WinCreateMsgQueue]]. NULLHANDLE is returned if an error occurred. | |||
:;NULLHANDLE | |||
::An error occurred. | |||
:;Other | |||
::Anchor-block handle. | |||
== | ==Remarks== | ||
This must be the first PM call issued by any application thread using Presentation Manager facilities. | |||
It returns hab, which is NULL if the initialization is not successful. | |||
The operating system does not generally use the information supplied by the hab parameter to its calls; instead, it deduces it from the identity of the thread that is making the call. Thus an OS/2 application is not required to supply any particular value as the hab parameter. However, in order to be portable to other environments, an application must provide the hab, that is returned by the WinInitialize function of the thread, to any OS/2 function that requires it. | |||
flOptions determines the initial state of message processing with respect to a created window. | |||
===Define (C/C++)=== | ===Define (C/C++)=== | ||
#define INCL_WINWINDOWMGR | #define INCL_WINWINDOWMGR | ||
or | or | ||
Line 28: | Line 42: | ||
===Sample Code=== | ===Sample Code=== | ||
[[HAB]] hab; | |||
HAB hab; | [[ULONG]] flOptions = 0L; | ||
ULONG flOptions = 0L; | [[HMQ]] hmq; | ||
HMQ hmq; | |||
hab=WinInitialize(flOptions); | hab=WinInitialize(flOptions); | ||
hmq=WinCreateMsgQueue(hab, 0L); | hmq=WinCreateMsgQueue(hab, 0L); | ||
Definiton | |||
<PRE> | |||
#define INCL_WINWINDOWMGR /* Or use INCL_WIN, INCL_PM, Also in COMMON section */ | |||
#include <os2.h> | |||
ULONG flOptions; /* Initialization options. */ | |||
HAB hab; /* Anchor-block handle. */ | |||
=== | hab = WinInitialize(flOptions); | ||
</PRE> | |||
===See Also=== | |||
*[[WinCreateMsgQueue]] | |||
*[[WinGetLastError]] | |||
*[[WinGetErrorInfo]] | |||
*[[WinQueryAnchorBlock]] | |||
*[[WinTerminate]] | |||
[[Category: | [[Category:Win]] |
Latest revision as of 23:01, 6 August 2023
Initializes the PM facilities to be used by an application.
Syntax
WinInitialize(flOptions)
Usage Explanation
This function must be the first PM function called by any application thread intending to use PM or GPI services. The return value is sometimes needed by other functions and should be saved. WinTerminate can be called if a thread no longer needs these services. This API can only be called once per thread.
Parameters
- flOptions (ULONG) - input
- Initialization options.
- The initial state for newly created windows is that all messages for the window are available for processing by the application.
- This is the only option available in PM.
Returns
- hab (HAB) - returns
- Anchor-block handle. This return value is a handle to an anchor block. The anchor block is a structure which is used by OS/2 to keep track of application specific error information, and the handle is needed for certain other PM functions, such as WinCreateMsgQueue. NULLHANDLE is returned if an error occurred.
- NULLHANDLE
- An error occurred.
- Other
- Anchor-block handle.
Remarks
This must be the first PM call issued by any application thread using Presentation Manager facilities.
It returns hab, which is NULL if the initialization is not successful.
The operating system does not generally use the information supplied by the hab parameter to its calls; instead, it deduces it from the identity of the thread that is making the call. Thus an OS/2 application is not required to supply any particular value as the hab parameter. However, in order to be portable to other environments, an application must provide the hab, that is returned by the WinInitialize function of the thread, to any OS/2 function that requires it.
flOptions determines the initial state of message processing with respect to a created window.
Define (C/C++)
#define INCL_WINWINDOWMGR
or
#define INCL_WIN
or
#define INCL_PM #include <os2.h>
Sample Code
HAB hab; ULONG flOptions = 0L; HMQ hmq; hab=WinInitialize(flOptions); hmq=WinCreateMsgQueue(hab, 0L);
Definiton
#define INCL_WINWINDOWMGR /* Or use INCL_WIN, INCL_PM, Also in COMMON section */ #include <os2.h> ULONG flOptions; /* Initialization options. */ HAB hab; /* Anchor-block handle. */ hab = WinInitialize(flOptions);