Jump to content

mciGetDeviceID

From EDM2
Revision as of 03:36, 5 November 2025 by Martini (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This function retrieves the device ID corresponding to an alias of a device. The ID can then be used on subsequent media control interface procedural commands. It also contains a 16-bit entry point.

Syntax

mciGetDeviceID(pszName)

Parameters

pszName (PSZ) - input
The alias name used with the open or connection command.

Return Code

rc (ULONG) - returns
Returns the device ID assigned to this alias when the device was opened or when the connection command with the query flag was issued. Returns 0 if the alias name is not known or is invalid.


Example Source Code

Declaration:

#define INCL_MCIOS2
#include <os2.h>

PSZ      pszName;  /*  Alias name. */
ULONG    rc;       /*  Return code. */

rc = mciGetDeviceID(pszName);

The following example illustrates how to retrieve a device ID.

     CHAR szBuffer[128];              /* Buffer for the string command */
     USHORT usDeviceID;               /* Return device ID              */

     strcpy(szBuffer,"open bell.wav alias wav1 wait");
                                            /* String command to open  */
                                            /* a wav file              */

     mciSendString ((PSZ)szBuffer,   /* Open a wav file                */
                     NULL,           /* No return message              */
                     0,              /* No return message length       */
                     0,              /* No handle to callback          */
                     0);             /* No notify parameter            */


    usDeviceID = mciGetDeviceID((PSZ) "wav1");
                                     /* Returns device ID              */
                                     /* Assigned on the alias "wav1"   */