與我們聯絡

與 Tek 業務代表即時對談。 上班時間:上午 6:00 - 下午 4:30 (太平洋時間)

致電

請致電

與 Tek 業務代表即時對談。 上班時間:上午 8:30 - 下午 5:30 (太平洋時間)

下載

下載手冊、產品規格表、軟體等等:

下載類型
機型或關鍵字

意見回饋

Why does my C/C++ program require a Window Handle to call the OpenDriverLINX function?

問題:

Why does my C/C++ program require a Window Handle to call the OpenDriverLINX function?

答案:

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.


此常見問答集適用於:

沒有任何產品系列

產品:

常見問答集 ID 72051

檢視所有常見問答集 »