简体   繁体   中英

Detect and re-activate my app if running - compact framework

Usually a mobile dev would not have to do this because the smart-minimise feature handles it.

But I need to do it myself because my mobile app is kicked off by a bootstrapper app.

The start menu icon kicks off the bottstrapper which downloads a target version from a web service, kicks it off and then closes. If the app gets minimised for whatever reason, the user would normally activate it again using the start menu icon. However, this kicks off the bootstrapper and results in a second copy of the client.

This question comes up everywhere on the net for desktop apps (and is in fact on this site). The usually cited solution is to use a combination of Process.GetProcessesByName combined with API calls to re-activate the process once found. Another solution is to create a controller class that inherits from some VisualBasic dll that I forget the name of. None of the solutions I have come across today are supported by the comapct framework.

So the actual question is a combination of:

Is there a compact framework alternative to Process.GetProcessesByName?

If not, what API call do I have to do instead?

I'm not sure if you found this yet or not, but MSDN has an article on creating a process manager application that has the info that I think you need.

The article reccomends using toolhelp.dll and has a pretty detailed looking walk-through for getting a list of running processes. It's for Visual Studio 2003, so you should probably be good with whatever version of VS.NET you're running.

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