Step 12 : Set Event

By using events, it is possible to notify various states (conversion end, error occurrence, etc.) that occurred during device operation to application programs.

Depending on the parameters passed in the event notification, you can get what kind of event occurred, and you can sort the processing by event.

There are the following two ways to notify events.

Message Notification

This is a method of notifying a message to the application by executing Win32 API's PostMessage function from the driver.
It is a commonly used message notification method.
How to create a handler to be called upon notification depends on the used development language.
It can not be used in applications that do not have Window handle (such as console application).

How to set message notification
Implement event message routines
Visual Basic .NET
Visual C#
Visual C++ (MFC)

Callback Function

A previously created callback function is registered, and the driver calls the registered function directly when notifying.
It is necessary to handle pointers and function pointers, but the amount of code is small and simple.
Callback function works faster than Windows message notification. And it can also be used in applications that do not have Window handle (such as console application).