How to Detect an Event With WIA Wait
The Windows Image Acquisition system service of Windows XP provides image acquisition services for scanners and cameras. It allows you to set up your WIA driver for reporting of the device activity. It also gives software developers the ability to monitor events that occur in the hardware, including the waiting state of the WIA device. When a WIA device signals an event, the WIA service passes the information about an event to your program. You need to add a reference to the "wiaaut.dll" file in .NET to detect a wait event with WIA service.
Instructions
-
-
1
Click the "Start" button in Windows and select "Microsoft Visual Studio" from the "All Programs" menu.
-
2
Click the "File," "Open" and open the C++ program which you'll use to detect a wait event with WIA service.
-
-
3
Add the following code after the "WIA.ImageFile" line in your C++ program:
WIA.DeviceManager oDM = new WIA.DeviceManagerClass();
private void button1_Click(object sender, System.EventArgs e)
{
oDM.RegisterEvent(WIA.EventID.wiaEventDeviceConnected,"*");
oDM.OnEvent+=new
WIA._IDeviceManagerEvents_OnEventEventHandler(oDM_OnEvent);
}
private void oDM_OnEvent(string EventID, string DeviceID, string ItemID)
{
System.Diagnostics.Debug.Write(DateTime.Now.ToLongDateString());
System.Diagnostics.Debug.WriteLine("EventID: " + EventID);
System.Diagnostics.Debug.WriteLine("DeviceID: " + DeviceID);
System.Diagnostics.Debug.WriteLine("ItemID: " + ItemID);
}
-
4
Click "File," "Save" to save your C++ program.
-
1
References
Resources
- Photo Credit Jupiterimages/Photos.com/Getty Images