The following example shows how the sample device driver handles the DVM_PALETTE message. The structure for DVM_PALETTERGB555 is similar.
DWORD NEAR PASCAL VideoConfigureMessage(PCHANNEL pChannel, UINT msg,
LONG lParam1, LONG lParam2)
{
LPVIDEOCONFIGPARMS lpcp;
LPDWORD lpdwReturn; // Return parameter from configure
LPVOID lpData1; // Pointer to data1
DWORD dwSize1; // size of data buffer1
LPVOID lpData2; // Pointer to data2
DWORD dwSize2; // size of data buffer2
DWORD dwFlags;
if (pChannel-> dwOpenType != VIDEO_IN)
return DV_ERR_NOTSUPPORTED;
dwFlags = lParam1;
lpcp = (LPVIDEOCONFIGPARMS) lParam2;
lpdwReturn = lpcp-> lpdwReturn;
lpData1 = lpcp-> lpData1;
dwSize1 = lpcp-> dwSize1;
lpData2 = lpcp-> lpData2;
dwSize2 = lpcp-> dwSize2;
switch (msg) {
case DVM_PALETTE:
switch (dwFlags) {
case (VIDEO_CONFIGURE_QUERY | VIDEO_CONFIGURE_SET):
case (VIDEO_CONFIGURE_QUERY | VIDEO_CONFIGURE_GET):
return DV_ERR_OK;
case VIDEO_CONFIGURE_QUERYSIZE:
case (VIDEO_CONFIGURE_QUERYSIZE | VIDEO_CONFIGURE_GET):
*lpdwReturn = sizeof(LOGPALETTE) +
(palCurrent.palNumEntries-1) *
sizeof(PALETTEENTRY);
break;
case VIDEO_CONFIGURE_SET:
case (VIDEO_CONFIGURE_SET | VIDEO_CONFIGURE_CURRENT):
if (!lpData1) // points to a LOGPALETTE structure.
return DV_ERR_PARAM1;
return (SetDestPalette ( (LPLOGPALETTE) lpData1,
(LPBYTE) NULL));
break;
case VIDEO_CONFIGURE_GET:
case (VIDEO_CONFIGURE_GET | VIDEO_CONFIGURE_CURRENT):
return (GetDestPalette ( (LPLOGPALETTE) lpData1,
(WORD) dwSize1));
break;
default:
return DV_ERR_NOTSUPPORTED;
} // end of DVM_PALETTE switch
return DV_ERR_OK;
.
.
.
default: // Not a message that we understand
return DV_ERR_NOTSUPPORTED;
} // end of message switch
return DV_ERR_NOTSUPPORTED;
}