Jump to content

mmioSendMessage

From EDM2

The mmioSendMessage function sends a message to the I/O procedure associated with a file that was opened with mmioOpen.

Syntax

#define INCL_MMIOOS2
#include <os2.h>

LONG mmioSendMessage(HMMIO hmmio, USHORT usMsg, LONG lParam1, LONG lParam2);

Parameters

hmmio (HMMIO) - input
The open file handle returned by mmioOpen.
usMsg (USHORT) - input
A message number. See MMIO Messages.
lParam1 (LONG) - input
Specifies additional message information. If lParam1 for the particular MMIO message being sent is not a LONG value, cast the value into a LONG data type.
lParam2 (LONG) - input
Specifies additional message information. If lParam2 for the particular MMIO message being sent is not a LONG value, cast the value into a LONG data type.

Return Value

rc (LONG) - returns
The return code is specific to the message sent. This includes both successful and failed returns. Regarding message-specific return codes, additional information may be contained in the ulErrorRet field of the MMIOINFO structure. This is accessed by calling mmioGetLastError.
  • MMIO_ERROR: The message cannot be routed to an IOProc. The handle might be invalid.
  • MMIOERR_UNSUPPORTED_MESSAGE: The I/O procedure does not support the message.

Remarks

An application can issue **mmioSendMessage** to send private messages to an installable I/O procedure. This function enables a program to call an I/O procedure directly (unlike system messages, which should be sent by the MMIO Manager).

`MMIOOS2.H` in the `\TOOLKIT\H` subdirectory defines the identifier `MMIOM_USER` so that you can create your own messages. The **mmioSendMessage** function requires that your custom messages be defined between the `MMIOM_USER` and `MMIOM_USER_END` values defined in the header file.

Example Code

The following code illustrates how to send a message to the IOProc to retrieve a handle to a compound file.

   HMMIO hmmio1;
   USHORT usMsg;
   LONG lParam1 = 0L;
   LONG lParam2 = 0L;
   LONG rc;
    ...

   usMsg = MMIOM_GETCF;

   rc = mmioSendMessage(hmmio1, usMsg, lParam1, lParam2);

   if (!rc)
   {
      /* error */
   }
   else
   {
      /* rc contains the handle to the compound file */
   }
    ...

Related Functions