How to run an application in background for windows mobile 6? [duplicate]
I am working on an application for windows mobile 6. I need to run my application in background . which i am doing using
private void app_menu_Closing(object sender, CancelEventArgs e)
{
this.Hide();
e.Cancel = true;
}
now i need to again launch my application to stop the applicat开发者_如何学编程ion but i am not able to do this. can anyone tell me how to do this?
Some options spring to mind:
- If you need to process window messages: Create an invisible 0-sized message-only window.
- If you need to listen to state changes in kernel synchronization objects: Don't create a window, but wait for those events, in a loop if needed, instead.
- If you need to listen to both: Create the message window and use MsgWaitForMultipleObjects to react to both window messages and kernel events.
For the service part of the question: You cannot create a true service in C#, you need to go native for that to happen. You can get "almost there" by using my points above, but a true service has special perks in the OS and you can't get near them in C#.
精彩评论