예제 #1
0
 /// <summary>
 /// Registers this application, so it will be notified for usb events.
 /// </summary>
 /// <param name="Handle">a IntPtr, that is a handle to the application.</param>
 /// <example> This sample shows how to implement this method in your form.
 /// <code>
 ///protected override void OnHandleCreated(EventArgs e)
 ///{
 ///    base.OnHandleCreated(e);
 ///    usb.RegisterHandle(Handle);
 ///}
 ///</code>
 ///</example>
 public void RegisterHandle(IntPtr Handle)
 {
     usb_event_handle = Win32Usb.RegisterForUsbEvents(Handle, device_class);
     this.handle      = Handle;
     //Check if the device is already present.
     CheckDevicePresent();
 }
예제 #2
0
 /// <summary>
 /// Регистрация для получения событий USB-шины.
 /// </summary>
 /// <param name="Handle">= IntPtr, путь до приложения.</param>
 public void RegisterHandle(IntPtr Handle)
 {
     usb_event_handle = Win32Usb.RegisterForUsbEvents(Handle, device_class);
     this.handle      = Handle;
     CheckDevicePresent();
 }