简体   繁体   中英

How to identify the lack of a touch screen and keyboard on Windows Mobile 6.5

How to identify the lack of a touch screen and keyboard on Windows-mobile 6.5?

If I don't touch the screen or press any key I need to go back to the main screen

How I can do it on C# on Windows Mobile 6.5?

I'll agree with Henk's comment that it's not clear if you want to detect the lack of input from a user or detect whether those interfaces are present at all. For detecting user idle conditions, this might be of interest . For detecting hardware interface availability, this might help .

I do this on my devices.

Just add a Timer and a short function called Reset() .

const int TIME_LIMIT = 50000; // set to whatever you need
int timeout;
Timer Timer1;

void Form1() {
   Timer1 = new Timer();
   Timer1.Interval = 200; // 200 milliseconds
   Timer1.Tick += new EventHandler(Timer_Tick);
}

void ShowSubPanel() {
  Timer_Reset();
  panelSub1.BringToFront();
}

void Timer_Reset() {
  Timer_Stop();
  Timer_Start();
}

void Timer_Start() {
  timeout = 0;
  Timer1.Start();
}

void Timer_Stop() {
  Timer1.Stop();
}

void Timer_Tick() {
  if (TIME_LIMIT < timeout++) {
    Timer_Stop();
    // Here, call your Main Form
    Main.BringToFront(); // I use Panels instead of forms
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM