[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

How can I programmatically terminate a process in windows mobile 6

Posted on 2009-07-16
9
Medium Priority
?
1,962 Views
Last Modified: 2013-12-21
I have a windows mobile 6 PDA/phone.
I have noticed that most applications for the platform don't properly terminate on exiting, they simply minimize and take up memory. In order to close them I have to go to Start-Settings-System-Memory-Running Programs and then click Stop All, or else the device will start to lag after using a few applications.
It would be nice to write small app that would loop through all open application processes and terminate them, to accomplish the task with one tap from the Today screen, instead of going into system settings every time I use an application, such as receiving a text message.
Does such an application exist? If not, which API could I use to write my own app for it?
0
Comment
Question by:colonel720
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +3
9 Comments
 
LVL 40

Expert Comment

by:mrjoltcola
ID: 24871024
Not that this answers your question regarding WM 6.0 but 6.1 now includes a task manager and it can be set on your Start menu and one tap gets to it, then you can select End All Tasks. Is 6.1 an option for your devices? The Task Manager is certainly my favorite feature of 6.1.

If not, there are some add-ons out there if you google: windows mobile task manager
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 24871042
in CF 2.0 you can just use

Process.Kill
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 24871043
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 24

Expert Comment

by:alexey_gusev
ID: 24871157
the key API here is ToolHelp API - CreateToolhelp32Snapshot(), Process32First/Next() etc - to enumerate all running processes if you're doing it in C++ (or use P/Invoke wrappers in cf.net available either in cf itself or OpenNETCF):

      HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS|TH32CS_SNAPNOHEAPS, 0);

Pay attention on TH32CS_SNAPNOHEAPS (0x40000000) - it prevents ~1MB heap allocation during snapshot creation :).

Once you have process ID, you can either brutally terminate it with TerminateProcess() or try to find a window (eg with EnumWindows() ) that belongs to that process and send it WM_CLOSE message to allow it to exit gracefully. Again, you can use P/Invoke wrappers if you develop in cf.net

Re. existing applications - well, google for Task Manager for mobile, I guess you can find something.
0
 
LVL 40

Expert Comment

by:mrjoltcola
ID: 24871257
In followup to my comment, check with your mobile carrier to see if they have a 6.1 upgrade, or if it is an unlocked device, check directly with the manufacturer (HTC, Samsung). I've upgraded a few models this year with both sources for the 6.1 ROMs.
0
 
LVL 33

Accepted Solution

by:
pgnatyuk earned 2000 total points
ID: 24872175
In the right-top corner should be a button that opens a drop down list with all running applications. Each item in this list has a close button on the right side.  This is the correct way to close the running applications. This application has name - Task Manager.
It's done so accordignly to the MS requiremenets/recommendations. That was (or is) Windows Mobile Logo program. In order to get this logo, all developers tried to to follow the MS guidelines. Looks like now this program is replaced by Windows Mobile Marketplace.
Here is a document about it: http://developer.windowsmobile.com/resources/en-US/Application%20Submission%20Guidelines.pdf
Here is the UI guidelines for 6:
http://msdn.microsoft.com/en-us/library/bb158602.aspx,
http://msdn.microsoft.com/en-us/library/ms854763.aspx
http://msdn.microsoft.com/en-us/library/ms854546.aspx
Here is for 5: http://www.windowsfordevices.com/articles/AT4228820897.html
It is really so, each application has a "close" button. Almost always it is in the right-top corner. But this button just moves the current application to the background.
In order to really close the application it is enough just to send WM_CLOSE message to the main application window.
Of course, you can find a lot of task managers in the internet - not only you don't like this annoying feature.
For example, here is HTC Task Manager:
http://www.freewarepocketpc.net/ppc-download-htc-task-manager-v2-0.html
 
 
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 24873309
More:
http://www.dewantoro.net/search/free+memory+cleaner+windows+mobile+6
This is an app that cleans the memory of the PDA: close non-responding tasks, clean registry, automatic clean, etc. It is a kind of a softer solution that just terminate all running processes.
another cleaner: http://www.newfreedownloads.com/Windows-Utilities/System-Utilities/MindSoft-Mobile-Utilities.html
 
0
 
LVL 1

Author Closing Comment

by:colonel720
ID: 31604315
The HTC task manager is really good, it even seems to detect when a window is closed with the "x" button and terminates the process. Guess I don't need to reinvent the wheel...
Thanks, and thanks to all who responded.
0
 

Expert Comment

by:rameshbs85
ID: 25420461
 Process.GetCurrentProcess().Kill();

Thats All

Thanks
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
This article provides a convenient collection of links to Microsoft provided Security Patches for operating systems that have reached their End of Life support cycle. Included operating systems covered by this article are Windows XP,  Windows Server…
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question