Jump to content

WinCreateMsgQueue: Difference between revisions

From EDM2
Ak120 (talk | contribs)
mNo edit summary
Line 1: Line 1:
==WinCreateMsgQueue==
;WinCreateMsgQueue( hab, maxMsg ) : Creates a message queue.
;WinCreateMsgQueue( hab, maxMsg ) : Creates a message queue.


====Usage Explanation====
==Usage Explanation==
After calling WinInitialize, you must call this function if your thread needs to respond to messages. Save the handle, as other functions need it as input.
After calling WinInitialize, you must call this function if your thread needs to respond to messages. Save the handle, as other functions need it as input.


====Parameters====
===Parameters===
 
; HAB hab (input) : Anchor block of calling thread (from WinInitialize or WinQueryAnchorBlock).
; HAB hab (input) : Anchor block of calling thread (from WinInitialize or WinQueryAnchorBlock).
; LONG maxMsg (input) : The number of messages the queue can hold. Pass 0 for system default.
; LONG maxMsg (input) : The number of messages the queue can hold. Pass 0 for system default.


====Returns====
===Returns===
 
; HMQ hmq : Handle to the newly created message queue. NULLHANDLE is returned if there was an error. WinGetLastError will return one of:
; HMQ hmq : Handle to the newly created message queue. NULLHANDLE is returned if there was an error. WinGetLastError will return one of:
 
0x100A PMERR_RESOURCE_NOT_FOUND
    0x100A PMERR_RESOURCE_NOT_FOUND
0x1011 PMERR_HEAP_OUT_OF_MEMORY
    0x1011 PMERR_HEAP_OUT_OF_MEMORY
0x1012 PMERR_HEAP_MAX_SIZE_REACHED
    0x1012 PMERR_HEAP_MAX_SIZE_REACHED
0x1018 PMERR_QUEUE_TOO_LARGE
    0x1018 PMERR_QUEUE_TOO_LARGE
0x1051 PMERR_NOT_IN_A_PM_SESSION
    0x1051 PMERR_NOT_IN_A_PM_SESSION
0x1052 PMERR_MSG_QUEUE_ALREADY_EXISTS
    0x1052 PMERR_MSG_QUEUE_ALREADY_EXISTS


====Define (C/C++)====
====Define (C/C++)====
 
#define INCL_WINMESSAGEMGR
  #define INCL_WINMESSAGEMGR
#include <os2.h>
  #include <os2.h>


====Example Code====
====Example Code====
Line 45: Line 39:


===Related Functions===
===Related Functions===
[[OS2 API:PMI:WinDestroyMsgQueue|WinDestroyMsgQueue]], [[OS2 API:PMI:WinPostMessage|WinPostMessage]], [[OS2 API:PMI:WinSendMessage|WinSendMessage]]
*[[WinDestroyMsgQueue]]
 
*[[WinPostMessage]]
=== OS Version Introduced ===
*[[WinSendMessage]]


[[Category:The OS/2 API Project]]
[[Category:Win]]

Revision as of 12:14, 17 November 2016

WinCreateMsgQueue( hab, maxMsg )
Creates a message queue.

Usage Explanation

After calling WinInitialize, you must call this function if your thread needs to respond to messages. Save the handle, as other functions need it as input.

Parameters

HAB hab (input)
Anchor block of calling thread (from WinInitialize or WinQueryAnchorBlock).
LONG maxMsg (input)
The number of messages the queue can hold. Pass 0 for system default.

Returns

HMQ hmq
Handle to the newly created message queue. NULLHANDLE is returned if there was an error. WinGetLastError will return one of:
0x100A PMERR_RESOURCE_NOT_FOUND
0x1011 PMERR_HEAP_OUT_OF_MEMORY
0x1012 PMERR_HEAP_MAX_SIZE_REACHED
0x1018 PMERR_QUEUE_TOO_LARGE
0x1051 PMERR_NOT_IN_A_PM_SESSION
0x1052 PMERR_MSG_QUEUE_ALREADY_EXISTS

Define (C/C++)

#define INCL_WINMESSAGEMGR
#include <os2.h>

Example Code

#define INCL_WINMESSAGEMGR 
#include <os2.h> 

HAB hab; 
ULONG flOptions = 0L; 
HMQ hmq; 

hab=WinInitialize(flOptions); 
hmq=WinCreateMsgQueue(hab, 0L); 

if (hmq) { 
          . 
          . 
          . 
         }

Related Functions