Jump to content

CcSendCommand

From EDM2

This function is used to control the captioning window once it has been created.

Syntax

ccSendCommand(usMsg, mp1, mp2)

Parameters

usMsg (USHORT) - input

This is one of the following commands you want to send to the captioning window.

CC_START (1)
Use this command to start captioning. "Start captioning" means to display the window that was created in the ccInitialize command, and to begin scrolling the appropriate text file in synch with an audio file. Set mp2 to point to a CC_START_PARMS structure.
CC_STOP (2)
Use this command to stop captioning. This command hides the caption window. Set mp1 and mp2 to zero.
CC_SET (3)
Use this command to set the status of the captioning system. The same items that can be queried can also be set. mp2 should point to a CC_SET_PARMS structure. Note that these items can be queried and set even while captioning is going on.
CC_STATUS (4)
Use this command to query the status of the captioning system. Status items you can query and set include:
           Number of text columns
           Number of text rows
           Text color
           Background color
           Caption window X and Y coordinates 
       mp2 should point to a CC_STATUS_PARMS structure. 
mp1 (MPARAM) - input
Caption window handle (returned from ccInitialize).
mp2 (MPARAM) - input
Data structure corresponding to the command message in usMsg.


Returns

rc (ULONG) - returns

The CC_STOP return value is 0; the other commands have the following return codes indicating success or failure:

Returns if the function is successful.

CCERR_CANNOT_CREATE_BITMAP
Returned to CC_START or CC_SET; the bitmap cannot be created.
CCERR_FILE_FORMAT
Returned to CC_START; invalid file format was used.
CCERR_NO_DEVICE_NAME
Returned to CC_START; no device name was given.
CCERR_TOO_MANY_LINES
Returned to CC_START; caption file has more than 500 lines.
DOS error codes
Returned to CC_START.
OS/2 multimedia error codes
Returned to CC_START.


Example Code

Declaration:

#include <os2.h>

USHORT    usMsg;
MPARAM    mp1;
MPARAM    mp2;
ULONG     rc;

rc = ccSendCommand(usMsg, mp1, mp2);

Use sample:

/*
  * Close caption flag is ON.
  * Fill in the CC_START_PARMS structure and the call ccSendCommand
  * to make the captioning window visible.  The hwndOwner field holds
  * the window handle that we want the Caption DLL to send the position
  * change messages to, when it is done processing them.
  */

 csp.pszDeviceName    = (PSZ)   "capsamp";     /* Alias name          */
 csp.pszCaptionFile   = (PSZ)   "CAPSAMP._CC"; /* File name to use    */
 csp.hwndOwner        =  hwnd;                 /* for position change */

 ulReturn = ccSendCommand ( CC_START, MPFROMHWND(hwndCaption), &csp );
                                               /* Start captioning    */

Related Functions