Click here to Skip to main content
15,887,376 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I want to start my application when the tablet PC has connected to the PC via the USB cable,I find some articles about detect the USB Flash Disk rather than the tablet,I know little about these technologies,Can you give me some tips or examples? I just want to detect the event that the tablet PC has connected to the PC.
Posted
Comments
Sergey Alexandrovich Kryukov 25-Dec-14 12:17pm    
Are you asking for detection on Windows side? Or on tablet side? But there is no such system as "Tablet PC". It all depends on what OS is there...
—SA
Member 11175072 25-Dec-14 23:28pm    
I want to asking for detection on the Windows side,The Table PC refers to the tablet.

go through below code provided in link[^]

and using Driveinfo you can use various properties to detect tablet PC

C#
using System.IO.DriveInfo;

 var availableDrives = DriveInfo.GetDrives()
.Where(d=> d.IsReady && d.DriveType == DriveType.Removable);
 
Share this answer
 
In Win7? If it's the first time of this kind connection, your PC need a drive program to start your tablet PC. Under normal conditions, your OS will search and download a matched driver and you can install it. After that you can find contents of your tablet PC in your computer.
 
Share this answer
 
Comments
Member 11175072 25-Dec-14 23:32pm    
Yes,it is in Win7,I want to be notified when the tablet has connected to the PC and than I can trigger something.
[no name] 26-Dec-14 1:21am    
Want your application running as long as the tablet has connected to the PC ?
You can check is there any disk inserted into when running timer background, if does, run the application. It's a thought.Only if your antivirus won't treat it as virus and kill it.
Member 11175072 29-Dec-14 8:11am    
Can you give me some code?
[no name] 29-Dec-14 22:40pm    
I didn't realize anything similar,but I googled sth. Hope helpful.
If you want to do something repeatedly, you should just use a loop iinside the backgroundworker DoWork() method. You can refer this to scan if your table PC has been connected.

http://stackoverflow.com/questions/19120914/timer-vs-repetitive-background-worker

The following is that you can set the time when to call your app:

http://stackoverflow.com/questions/19120914/timer-vs-repetitive-background-worker

http://stackoverflow.com/questions/6292362/how-to-start-a-backgroundworker-on-a-specific-time

And the way declare background tasks declare:

http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh977049.aspx

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900