Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

Message passing functions
[Message functions]

Data Structures

Defines

Typedefs

Functions


Define Documentation

#define PM_NOREMOVE   0x0000
 

See also:
PeekMessage PeekMessageEx

Definition at line 1918 of file window.h.

#define PM_NOYIELD   0x0002
 

See also:
PeekMessage PeekMessageEx PeekPostMessage

Definition at line 1932 of file window.h.

#define PM_REMOVE   0x0001
 

See also:
PeekMessage PeekMessageEx PeekPostMessage

Definition at line 1925 of file window.h.

#define SendAsyncMessage   SendMessage
 

Is an alias of SendMessage for MiniGUI-Processes and MiniGUI-Standalone.

See also:
SendMessage

Definition at line 2091 of file window.h.


Typedef Documentation

typedef struct _MSG MSG
 

The message structure.

See also:
GetMessage, PostMessage, Messages


Function Documentation

int BroadcastMessage int  iMsg,
WPARAM  wParam,
LPARAM  lParam
 

Broadcasts a message to all main window on the desktop.

This function posts the message specified by (iMsg, wParam, lParam) to all the main windows on the desktop.

Parameters:
iMsg The message identifier.
wParam The first parameter of the message.
lParam The second parameter of the message.
Returns:
0 if all OK, < 0 on error.
See also:
PostMessage

int DispatchMessage PMSG  pMsg  ) 
 

Dispatches a message to the window's callback procedure.

This function dispatches the message pointed to by pMsg to the target window's callback procedure.

Parameters:
pMsg The pointer to the message.
Returns:
The return value of the message handler.
See also:
GetMessage
Example:

/*
 * A typical message loop.
 */

    MSG Msg;
    MAINWINCREATE CreateInfo;
    HWND hMainWnd;

    InitCreateInfo (&CreateInfo);

    hMainWnd = CreateMainWindow (&CreateInfo);
    if (hMainWnd == HWND_INVALID)
        return -1;

    while (GetMessage (&Msg, hMainWnd)) {
        TranslateMessage (&Msg);
        DispatchMessage (&Msg);
    }

BOOL EmptyMessageQueue HWND  hWnd  ) 
 

Empties a message queue.

This function empties the message queue of the main window hWnd.

Parameters:
hWnd The handle to the main window.
Returns:
TRUE on all success, FALSE on error.
Note:
Only defined for MiniGUI-Processes.
See also:
ThrowAwayMessages

int GetMessage PMSG  pMsg,
HWND  hMainWnd
 

Gets a message from the message queue of a main window.

This function gets a message from the message queue of the main window hMainWnd, and returns until there is a message in the message queue.

Parameters:
pMsg Pointer to the result message.
hMainWnd Handle to the window.
Returns:
0 on MSG_QUIT have been found, else gets a message.
See also:
HavePendingMessage, PostQuitMessage, MSG
Example:

/*
 * A typical message loop.
 */

    MSG Msg;
    MAINWINCREATE CreateInfo;
    HWND hMainWnd;

    InitCreateInfo (&CreateInfo);

    hMainWnd = CreateMainWindow (&CreateInfo);
    if (hMainWnd == HWND_INVALID)
        return -1;

    while (GetMessage (&Msg, hMainWnd)) {
        TranslateMessage (&Msg);
        DispatchMessage (&Msg);
    }

BOOL HavePendingMessage HWND  hMainWnd  ) 
 

Checks if there is any pending message in the message queue of a main window.

This function checks whether there is any pending message in the message queue of the main window hMainWnd.

Parameters:
hMainWnd The handle to the main window.
Returns:
TRUE for pending message, FALSE for empty message queue.
See also:
GetMessage, MSG

const char *GUIAPI Message2Str int  message  ) 
 

Translates a message identifier to the message string.

This function returns the message string of the message identifier message. E.g. this function will return the string of "MSG_CHAR" for MSG_CHAR message.

Parameters:
message The message identifier.
Returns:
The message string.
Note:
Only available if defined _MSG_STRING.
See also:
PrintMessage

BOOL PeekMessage PMSG  pMsg,
HWND  hWnd,
int  iMsgFilterMin,
int  iMsgFilterMax,
UINT  uRemoveMsg
 

Peeks a message from the message queue of a main window.

This functions peek a message from the message queue of the window hWnd and returns immediatly. Unlike GetMessage, this function does not wait for a message.

Parameters:
pMsg Pointer to the result message.
hWnd The handle to the window.
iMsgFilterMin The min identifier of the message that should be peeked.
iMsgFilterMax The max identifier of the message that should be peeked.
uRemoveMsg Whether remove the message from the message queue. Should be the following values:
  • PM_NOREMOVE
    Leave it in the message queue.
  • PM_REMOVE Remove it from the message queue.
  • PM_NOYIELD Nouse now.
Returns:
TRUE if there is a message peeked, or FALSE.
See also:
GetMessage, PeekPostMessage, HavePendingMessage, PostMessage

BOOL PeekMessageEx PMSG  pMsg,
HWND  hWnd,
int  iMsgFilterMin,
int  iMsgFilterMax,
BOOL  bWait,
UINT  uRemoveMsg
 

Peeks a message from the message queue of a main window.

This functions peek a message from the message queue of the window hWnd; if bWait is TRUE, it will wait for the message, else return immediatly.

Parameters:
pMsg Pointer to the result message.
hWnd The handle to the window.
iMsgFilterMin The min identifier of the message that should be peeked.
iMsgFilterMax The max identifier of the message that should be peeked.
bWait Whether to wait for a message.
uRemoveMsg Whether remove the message from the message queue. Should be the following values:
  • PM_NOREMOVE
    Leave it in the message queue.
  • PM_REMOVE Remove it from the message queue.
  • PM_NOYIELD Nouse now.
Returns:
TRUE if there is a message peeked, or FALSE.
See also:
GetMessage, PeekPostMessage, HavePendingMessage, PostMessage

BOOL PeekPostMessage PMSG  pMsg,
HWND  hWnd,
int  iMsgFilterMin,
int  iMsgFilterMax,
UINT  uRemoveMsg
 

Peeks a post message from the message queue of a main window.

This functions peek a message from the message queue of the window hWnd and returns immediatly. Unlike PeekMessage, this function only peek a post message.

Parameters:
pMsg Pointer to the result message.
hWnd The handle to the window.
iMsgFilterMin The min identifier of the message that should be peeked.
iMsgFilterMax The max identifier of the message that should be peeked.
uRemoveMsg Whether remove the message from the message queue. Should be the following values:
  • PM_NOREMOVE
    Leave it in the message queue.
  • PM_REMOVE Remove it from the message queue.
  • PM_NOYIELD Nouse now.
Returns:
TRUE if there is a message peeked, or FALSE.
See also:
GetMessage, PeekMessage, HavePendingMessage, PostMessage

int PostMessage HWND  hWnd,
int  iMsg,
WPARAM  wParam,
LPARAM  lParam
 

Posts a message into the message queue of a window and returns immediatly.

This functions posts a message into the message queue of the window hWnd and returns immediately.

Parameters:
hWnd The handle to the window.
iMsg The identifier of the message.
wParam The first parameter of the message.
lParam The second parameter of the message.
Returns:
ERR_OK on success, < 0 on errors.
Return values:
ERR_OK Post message successfully.
ERR_QUEUE_FULL The message queue is full.
ERR_INV_HWND Invalid window handle.
See also:
SendMessage

int PostQuitMessage HWND  hWnd  ) 
 

Puts a MSG_QUIT message into the message queue of a main window.

This function puts a MSG_QUIT message into the message queue of the main window hWnd. The next call to GetMessage will return 0.

Parameters:
hWnd The handle to the main window.
Returns:
0 if all OK, < 0 on error.
See also:
GetMessage

void GUIAPI PrintMessage FILE *  fp,
HWND  hWnd,
int  iMsg,
WPARAM  wParam,
LPARAM  lParam
 

Prints a message in readable string form to a stdio stream.

This function prints the message specified by (iMsg, wParam, lParam) in readable string form to the stdio stream fp.

Parameters:
fp The pointer to the FILE object.
hWnd The target window of the message.
iMsg The message identifier.
wParam The first parameter of the message.
lParam The second parameter of the message.
See also:
Message2Str

BOOL Send2ActiveWindow const MG_Layer layer,
int  iMsg,
WPARAM  wParam,
LPARAM  lParam
 

Sends a message to the active window in layer.

This function sends the message specified by (iMsg, wParam, lParam) to the current active window in the specific layer (layer).

Parameters:
layer The pointer to the layer.
iMsg The message identifier.
wParam The first parameter of the message.
lParam The second parameter of the message.
Returns:
TRUE on success, FALSE on error.
Note:
This function is only defined for MiniGUI-Processes, and can be called only by the server, i.e. mginit.
See also:
Send2Client

int Send2Client MSG msg,
int  cli
 

Sends a message to a client.

This function sends a message to the specified client cli.

Parameters:
msg The pointer to the message.
cli Either be the identifier of the targe client or one of the following values:
  • CLIENT_ACTIVE
    The current active client on the topmost layer.
  • CLIENTS_TOPMOST
    All clients in the topmost layer.
  • CLIENTS_EXCEPT_TOPMOST
    All clients except clients in the topmost layer.
  • CLIENTS_ALL
    All clients.
Returns:
The number of bytes sent, < 0 on error.
Return values:
SOCKERR_OK Read data successfully.
SOCKERR_IO There are some I/O errors occurred.
SOCKERR_CLOSED The socket has been closed by the peer.
SOCKERR_INVARG You passed invalid arguments.
Note:
This function is only defined for MiniGUI-Processes, and can be called only by the server, i.e. mginit.
See also:
Send2TopMostClients, Send2ActiveWindow

BOOL Send2TopMostClients int  iMsg,
WPARAM  wParam,
LPARAM  lParam
 

Sends a message to all clients in the topmost layer.

This function sends the message specified by (iMsg, wParam, lParam) to all clients in the topmost layer.

Parameters:
iMsg The message identifier.
wParam The first parameter of the message.
lParam The second parameter of the message.
Returns:
TRUE on success, FALSE on error.
Note:
This function is only defined for MiniGUI-Processes, and can be called only by the server, i.e. mginit.

The message will be sent to the virtual desktop of the target client.

See also:
Send2Client, Send2ActiveWindow

int SendMessage HWND  hWnd,
int  iMsg,
WPARAM  wParam,
LPARAM  lParam
 

Sends a message to a window.

This function sends a message to the window hWnd, and will return until the message-handling process returns.

Parameters:
hWnd The handle to the window.
iMsg The identifier of the message.
wParam The first parameter of the message.
lParam The second parameter of the message.
Returns:
The return value of the message handler.
See also:
PostMessage

int SendNotifyMessage HWND  hWnd,
int  iMsg,
WPARAM  wParam,
LPARAM  lParam
 

Sends a notification message to a window.

This function sends the notification message specified by (iMsg, wParam, lParam) to the window hWnd. This function puts the notication message in the message queue and then returns immediately.

Parameters:
hWnd The handle to the window.
iMsg The message identifier.
wParam The first parameter of the message.
lParam The second parameter of the message.
Returns:
0 if all OK, < 0 on error.
See also:
SendMessage, PostMessage

void GUIAPI SetAutoRepeatMessage HWND  hwnd,
int  msg,
WPARAM  wParam,
LPARAM  lParam
 

Sets the auto-repeat message.

This function sets the auto-repeat message. When the default message procedure receives an MSG_IDLE message, the default handler will send the auto-repeat message to the target window as a notification message.

Parameters:
hwnd The handle to the target window. Set it to zero to disable the auto-repeat message.
msg The identifier of the auto-repeat message.
wParam The first parameter of the auto-repeat message.
lParam The second parameter of the auto-repeat message.

BOOL SetKeyboardLayout const char *  kbd_layout  ) 
 

Sets a new keyboard layout.

This function sets the keymaps to translate key scancodes to MSG_CHAR or MSG_KEYSYM messages. The default keymaps is for US PC keyboard layout, you can call this function to set a different keyboard layout. The argument of kbd_layout specifies the name of the keyboard layout.

Parameters:
kbd_layout The keyboard layout name. It can be one of the following values:
  • KBD_LAYOUT_DEFAULT
    The default keyboard layout, i.e., US PC.
  • KBD_LAYOUT_FRPC
    The France PC keyboard layout.
  • KBD_LAYOUT_FR
    The France keyboard layout.
  • KBD_LAYOUT_DE
    The German keyboard layout.
  • KBD_LAYOUT_DELATIN1
    The German Latin1 keyboard layout.
  • KBD_LAYOUT_IT
    The Italian keyboard layout.
  • KBD_LAYOUT_ES
    The Spanish keyboard layout.
  • KBD_LAYOUT_ESCP850
    The Spanish CP850 keyboard layout.

Returns:
TRUE for success, otherwise FALSE.
See also:
TranslateMessage, MSG_CHAR, MSG_KEYSYM

int ThrowAwayMessages HWND  pMainWnd  ) 
 

Removes all messages in the message queue associated with a window.

This function removes all messages which are associated with the specified window pMainWnd.

Parameters:
pMainWnd The handle to the window.
Returns:
The number of thrown messages.
See also:
EmptyMessageQueue

BOOL GUIAPI TranslateKeyMsgToChar int  message,
WPARAM  wParam,
LPARAM  lParam,
WORD ch
 

Translates a key down and key up message to a corresponding character.

This function translates a key down and key up message to a character. If the message is not a key message, this function does nothing.

The behavior of this function is inflected by the current keyboard layout. The default keyboard layout is US PC keyboard, but you can call SetKeyboardLayout function to set a different keyboard layout.

Parameters:
message The type of message.
wParam Message parameter.
lParam Message parameter.
ch A string buffer for storing translated characters.
Returns:
A boolean indicates whether the message is a key message.
See also:
TranslateMessage

BOOL TranslateMessage PMSG  pMsg  ) 
 

Translates key down and key up messages to MSG_CHAR message and post it into the message queue.

This function translates key down and key up message to an MSG_CHAR message or some MSG_KEYSYM messages, and send the message(s) to the window procedure as a notification message. If the message is not a key message, this function does nothing.

The behavior of this function is inflected by the current keyboard layout. The default keyboard layout is US PC keyboard, but you can call SetKeyboardLayout function to set a different keyboard layout.

Parameters:
pMsg The pointer of message.
Returns:
A boolean indicates whether the message is a key message.
See also:
SetKeyboardLayout, MSG_CHAR, MSG_KEYSYM

BOOL WaitMessage PMSG  pMsg,
HWND  hMainWnd
 

Waits for a message from the message queue of a main window.

This function waits for a message from the message queue of the main window hMainWnd, and returns until there is a message in the message queue. Unlike GetMessage, this function does not remove the message from the message queue.

Parameters:
pMsg Pointer to the result message.
hMainWnd Handle to the window.
Returns:
0 on MSG_QUIT have been found, else gets a message.
See also:
HavePendingMessage, PostQuitMessage, MSG


Generated on Mon Jun 26 14:21:39 2006 for MiniGUI V2.0.3 API Reference by  doxygen 1.4.2