The following code illustrates how to initialize multiple devices in a group simultaneously.
/*** Sample code to make a group using mciSendCommand. ***/ MCI_GROUP_PARMS mciGroupParameters; ULONG paulDeviceIDs[4]; ULONG ulRC; ULONG ulGroupFlags; /********************************************************************/ /*** Assume code is here to open four devices and store their ***/ /*** device IDs in the array ***/ /*** paulDeviceIDs[0]...paulDeviceIDs[3] ***/ /********************************************************************/ ulGroupFlags = MCI_GROUP_MAKE; /* Make a group */ mciGroupParameters.hwndCallback= (HWND) NULL;/* No NOTIFY will be used. */ mciGroupParameters.usGroupID = 0; /* This will be returned. */ mciGroupParameters.pszGroupAlias= (PSZ) NULL;/* No alias will be used. */ mciGroupParameters.ulNumDevices = 4; /* Group four devices. */ mciGroupParameters.paulDeviceID = paulDeviceIDs;/* This array contains */ the four device IDs. */ ulRC = mciSendCommand( 0, /* We don't know the group's ID yet. */ MCI_GROUP, /* MCI_GROUP message. */ ulGroupFlags, /* Flags for the MCI_GROUP message. */ (PVOID)&mciGroupParameters /* Parameters for the message. */ 0 ); /* User parameter. */ /********************************************************************/ /*** On successful return, a group will have been created ***/ /*** combining the four devices (whose device IDs were in the ***/ /*** paulDeviceIDs array) into one "grouped" device. This ***/ /*** "grouped" device will have a device ID of its own found in ***/ /*** the mciGroupParameters.usGroupID field. ***/ /********************************************************************/