Configuración de un controlador instalable
Para dirigir un controlador instalable para llevar a cabo tareas útiles, debe abrir el controlador mediante la función OpenDriver y enviarlos mensajes mediante la función SendDriverMessage . En el ejemplo siguiente se muestra cómo dirigir al controlador para mostrar su cuadro de diálogo de configuración.
LONG MyConfigureDriver()
{
HDRVR hdrvr;
DRVCONFIGINFO dci;
LONG lRes;
// Open the driver (no additional parameters needed this time).
if ((hdrvr = OpenDriver(L"\\samples\\sample.drv", 0, 0)) == 0) {
// Can't open the driver
return DRVCNF_CANCEL;
}
// Make sure driver has a configuration dialog box.
if (SendDriverMessage(hdrvr, DRV_QUERYCONFIGURE, 0, 0) != 0) {
// Set the DRVCONFIGINFO structure and send the message
dci.dwDCISize = sizeof (dci);
dci.lpszDCISectionName = (LPWSTR)0;
dci.lpszDCIAliasName = (LPWSTR)0;
lRes = SendDriverMessage(hdrvr, DRV_CONFIGURE, 0, (LONG)&dci);
}
// Close the driver (no additional parameters needed this time).
CloseDriver(hdrvr, 0, 0);
return lRes;
}