The following code illustrates how to query a stream handler for a specific stream protocol.
#include "os2.h" #include "os2me.h" ULONG ulRC; /* Error return code */ HID hidTarget; /* Target handler ID */ SPCBKEY spcbkey; /* Data type to stream */ SPCB spcb; /* Stream protocol */ . . . /*--------------------------------------------------------------------*/ /* Get the stream handler ID (hidTarget) for the digital audio stream*/ /* handler using SpiGetHandler. */ /*---------------------------------------------------------------------/ . . . /*--------------------------------------------------------------------*/ /* Get the stream protocol control block (SPCB) for the given stream */ /* handler and SPCB key. */ /*--------------------------------------------------------------------*/ spcbkey.ulDataType = DATATYPE_WAVEFORM; spcbkey.ulDataSubType = WAVE_FORMAT_4S16; spcbkey.ulIntKey = 0; if (ulRC = SpiGetProtocol( hidTarget, &spcbkey, &spcb)) return(ulRC); /* error! */