Ejemplo n.º 1
0
VideoCapture::VideoCapture()
{
	cameraInitialized = false;
	

	CoInitialize(NULL);
	ZeroVariables();

	if (EnumDevices()==0) throw -1;
	
	EnumResolutions();
}
Ejemplo n.º 2
0
void CameraDialog::OnCbnSelchangeComboCamera()
{
	EnumResolutions();
//	Capture->CloseInterfaces();
}
Ejemplo n.º 3
0
DWORD
DrvDeviceCapabilities(
    HANDLE      hPrinter,
    PWSTR       pDeviceName,
    WORD        wCapability,
    PVOID       pOutput,
    PDEVMODE    pDevmode
    )

/*++

Routine Description:

    Provides information about the specified device and its capabilities

Arguments:

    hPrinter - Identifies a printer object
    pDeviceName - Points to a null-terminated device name string
    wCapability - Specifies the interested device capability
    pOutput - Points to the output buffer
    pDevmode - Points to the source devmode structure

Return Value:

    The return value depends on iDevCap.
    Please refer for DDK documentation for more details.

--*/

{
    XLDEVMODE   dm;
    PMPD        pmpd;
    DWORD       result;
    FORM_INFO_1 *pFormsDB;
    DWORD       cForms;

    //
    // Load printer description data
    //

    if (! (pmpd = LoadMpdFile(hPrinter))) {

        Error(("Failed to load printer description data\n"));
        return GDI_ERROR;
    }

    //
    // Validate source devmode and combine it with driver default
    //

    if (! GetCombinedDevmode(&dm, pDevmode, hPrinter, pmpd)) {

        Error(("Bad input devmode\n"));
        UnloadMpdFile(pmpd);
        return GDI_ERROR;
    }

    pDevmode = &dm.dmPublic;

    switch (wCapability) {

    case DC_VERSION:

        result = pDevmode->dmSpecVersion;
        break;

    case DC_DRIVER:

        result = pDevmode->dmDriverVersion;
        break;

    case DC_SIZE:

        result = pDevmode->dmSize;
        break;

    case DC_EXTRA:

        result = pDevmode->dmDriverExtra;
        break;

    case DC_FIELDS:

        result = pDevmode->dmFields;
        break;

    case DC_COPIES:

        result = MAX_COPIES;
        break;

    case DC_DUPLEX:

        result = SupportDuplex(pmpd) ? 1 : 0;
        break;

    case DC_TRUETYPE:

        result = pDevmode->dmTTOption;
        break;

    case DC_ORIENTATION:

        //
        // Normal landscape rotates counterclockwise
        // Rotated landscape rotates clockwise
        //

        result = LandscapeRotation(&dm);
        break;

    case DC_PAPERNAMES:
    case DC_PAPERS:
    case DC_PAPERSIZE:
    case DC_MINEXTENT:
    case DC_MAXEXTENT:

        //
        // Get a list of forms in the forms database
        //

        pFormsDB = GetFormsDatabase(hPrinter, &cForms);

        if (pFormsDB == NULL || cForms == 0) {

            Error(("Cannot get system forms\n"));
            UnloadMpdFile(pmpd);
            return GDI_ERROR;
        }

        FilterFormsDatabase(pFormsDB, cForms, pmpd);

        switch (wCapability) {

        case DC_MINEXTENT:
        case DC_MAXEXTENT:

            result = CalcMinMaxExtent(pOutput, pmpd, pFormsDB, cForms, wCapability);
            break;

        case DC_PAPERNAMES:
        case DC_PAPERS:
        case DC_PAPERSIZE:

            result = EnumPaperSizes(pOutput, pmpd, pFormsDB, cForms, wCapability);
            break;

        }

        MemFree(pFormsDB);
        break;

    case DC_BINNAMES:
    case DC_BINS:

        result = EnumOutputBins(pOutput, pmpd, wCapability);
        break;

    case DC_ENUMRESOLUTIONS:

        result = EnumResolutions(pOutput, pmpd);
        break;

    default:

        Error(("Unknown device capability: %d\n", wCapability));
        result = GDI_ERROR;
        break;
    }

    UnloadMpdFile(pmpd);
    return result;
}