Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Mobile Development
  3. Mobile
  4. How to catch usb event

How to catch usb event

Scheduled Pinned Locked Moved Mobile
tutorialquestion
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    haolan
    wrote on last edited by
    #1

    Hi there. Is there any way I can catch an event, when i plug a cable from my device to a computer? When there is an active connection between the two devices I want to show a dialog box in my mobile application. Haolan

    R 1 Reply Last reply
    0
    • H haolan

      Hi there. Is there any way I can catch an event, when i plug a cable from my device to a computer? When there is an active connection between the two devices I want to show a dialog box in my mobile application. Haolan

      R Offline
      R Offline
      Ravenet
      wrote on last edited by
      #2

      Please check Windows Mobile API there is lot of system states.

      Cheers,Earn and Enjoy RRave MCTS,MCPD http://ravesoft.blogspot.com

      H 1 Reply Last reply
      0
      • R Ravenet

        Please check Windows Mobile API there is lot of system states.

        Cheers,Earn and Enjoy RRave MCTS,MCPD http://ravesoft.blogspot.com

        H Offline
        H Offline
        haolan
        wrote on last edited by
        #3

        Can you tell me more specific where I can find these system states?

        R 1 Reply Last reply
        0
        • H haolan

          Can you tell me more specific where I can find these system states?

          R Offline
          R Offline
          Ravenet
          wrote on last edited by
          #4

          Hi Please search in msdn2.microsoft.com There are you can find get all system sattes.

          Cheers,Earn and Enjoy RRave MCTS,MCPD http://ravesoft.blogspot.com

          H 1 Reply Last reply
          0
          • R Ravenet

            Hi Please search in msdn2.microsoft.com There are you can find get all system sattes.

            Cheers,Earn and Enjoy RRave MCTS,MCPD http://ravesoft.blogspot.com

            H Offline
            H Offline
            haolan
            wrote on last edited by
            #5

            I found this: http://msdn2.microsoft.com/en-us/library/microsoft.windowsmobile.status.systemstate.activesyncstatus.aspx[^] With this I have written the following code: void activeSyncState_Changed(object sender, ChangeEventArgs args) { ActiveSyncStatus status = (ActiveSyncStatus)args.NewValue; try { if (status == ActiveSyncStatus.Synchronizing) { MessageBox.Show("Hello world!"); } } catch (Exception ex) { // Handle Exception } } SystemState activeSyncState = new SystemState(SystemProperty.ActiveSyncStatus); activeSyncState.Changed += new ChangeEventHandler(activeSyncState_Changed); But when I plug in my cable nothing happens. But I guess I dont use the right api, because I need to fire my event when a connection is established and not when activesync is synchronizing. Is there any way to do that?

            R 1 Reply Last reply
            0
            • H haolan

              I found this: http://msdn2.microsoft.com/en-us/library/microsoft.windowsmobile.status.systemstate.activesyncstatus.aspx[^] With this I have written the following code: void activeSyncState_Changed(object sender, ChangeEventArgs args) { ActiveSyncStatus status = (ActiveSyncStatus)args.NewValue; try { if (status == ActiveSyncStatus.Synchronizing) { MessageBox.Show("Hello world!"); } } catch (Exception ex) { // Handle Exception } } SystemState activeSyncState = new SystemState(SystemProperty.ActiveSyncStatus); activeSyncState.Changed += new ChangeEventHandler(activeSyncState_Changed); But when I plug in my cable nothing happens. But I guess I dont use the right api, because I need to fire my event when a connection is established and not when activesync is synchronizing. Is there any way to do that?

              R Offline
              R Offline
              Ravenet
              wrote on last edited by
              #6

              Hi i tried same code it's work for me it's wok please double checok u registrated dll in ur enumaltor Thank you

              Cheers,Earn and Enjoy RRave MCTS,MCPD http://ravesoft.blogspot.com

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups