win12.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
WinCreateMsgQueue (1.2)
Function Group  Overview                          Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_WINMESSAGEMGR
 
HMQ WinCreateMsgQueue(hab, cmsg)
HAB hab;       /* handle of the anchor block */
SHORT cmsg;    /* size of the message queue  */
 
The WinCreateMsgQueue function creates a message queue for the current
thread. This function must be called after the WinInitialize function but
before any other Presentation Manager functions are called. It can be called
only once per thread.
 
Parameter  Description
────────────────────────────────────────────────────────────────────────────
 
hab        Identifies the anchor block.
 
cmsg       Specifies the maximum queue size. This parameter can use a value
           of DEFAULT_QUEUE_SIZE to get the system default queue size.
 
Return Value
 
The return value identifies a message queue, or it is NULL if the queue
cannot be created.
 
Comments
 
The default queue size is 10 messages which is sufficient for most
applications. However, if an application processes a high volume of
messages, and the processing of some of these messages is slow, the
application should create a larger queue.
 
Example
 
This example shows the typical startup code for a thread that will be making
Presentation Manager function calls; in this case the startup function of
the application. It calls WinInitialize to initialize the thread for making
Presentation Manager function calls, and WinCreateMsgQueue to create a
message queue for the thread. Before the thread terminates, it calls
WinDestroyMsgQueue to destroy the message queue.
 
HAB hab;    /* handle to the anchor block  */
HMQ hmq;    /* handle to the message queue */
 
VOID cdecl main() {
    hab = WinInitialize(0);
    hmq = WinCreateMsgQueue(hab, DEFAULT_QUEUE_SIZE);
        .
        . /* initialization and message loop */
        .
    WinDestroyMsgQueue(hmq);
    WinTerminate(hab);
    DosExit(EXIT_PROCESS, 0);
}
 
See Also
 
WinDestroyMsgQueue, WinInitialize