Solved

How can I programmatically terminate a process in windows mobile 6

Posted on 2009-07-16
9
1,928 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
  • 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
 
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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
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 500 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Once again I push the limits of my phone.  An introduction to the Android Google Now Launcher.
Several part series to implement Internet Explorer 11 Enterprise Mode
This Micro Tutorial will give you a basic overview of Windows DVD Burner through its features and interface. This will be demonstrated using Windows 7 operating system.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

708 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now