Frage:
Why does my C/C++ program require a Window Handle to call the OpenDriverLINX function?
Antwort:
Why does my C/C++ program require a Window Handle to call the OpenDriverLINX function?
DriverLINX anticipates that you will, in most cases, use Windows' messaging to coordinate program execution with the status of the board's acquisition. This is important for background tasks (IRQ or DMA mode). The window handle tells DriverLINX which window (application) should be sent these message notifications (ServiceDone, BufferFilled, DataLost, StopEvent, etc.) from the driver.
But for polled mode tasks common to the use of digital I/O boards especially, use of messages is not necessary. In that case, you could pass the handle of the desktop window to the OpenDriverLINX function. This is often the case if the application is a console (DOS box) or is LabWindows/CVI with no panel. Do this:
HWND window; // window handle
HINSTANCE hInstance; // instance handle for the driver session
window = GetDesktopWindow(); // our messages will be sent to desktop (not processed)
hInstance = OpenDriverLINX(window,"driverName");
If the driver does not successfully open with the "driverName" string provided, then the OpenDriverLINX dialog (popup) will appear.
If you have an ISA digital I/O board, the name of your driver is kmbpio
If you have a PCI digital I/O board, the name of your driver is kpcipio
A final note on the messages: if your polled mode application will not process messages to know the state of the task, you can tell DriverLINX not to send any by use of the taskFlags member:
pSR->taskFlags = NO_SERVICESTART | NO_SERVICEDONE
Polled mode tasks can send two messages: one when the service starts, and one when it is finished. This line tells DriverLINX not to send them.
Diese FAQs beziehen sich auf:
Keine Produktreihe
Produkt:
FAQ-ID 72051
Alle FAQs ansehen »