c# - See exact time a usb device was removed Windows 7 -
a little background, trying calibrate usb accelerometer starts timing moment removed usb drive, suspect timing bit off, leads me problem...
is there way of seeing exact time device removed?
i time in milliseconds, somehting solved programatically using c#, or there log somewhere in windows 7? open solution.
you write simple c# app , subscribe win api notifications device node changes system.
the api function registerdevicenotification allows subscribe application or service notified windows when alter occurs device (i.e. hot-plug or unplug).
your c# application have phone call register method @ start-up, , application have handle wm_devicechanged event within application's wndproc. way access wndproc different depending on whether take write wpf application or winforms application.
the wm_devicechanged message have wparam set specific value, depending on whether device plugged in, it's beingness removed, or removed. in case want utilize dbt_deviceremovecomplete message.
you can have c# app log exact time device removed. note accuracy of time-stamp depend on delay exists between device beingness removed , application receiving , handling notification. there no system-level time-stamp available have do. should accurate within "few" milliseconds.
c# windows-7 usb
No comments:
Post a Comment