?
Solved

Closing a group of applications in windows Ce

Posted on 2010-01-12
10
Medium Priority
?
517 Views
Last Modified: 2013-12-05
Hi all,

I have a bunch of applications running under Windows CE 5.0
I would like to develop an application that will automatically close (gracefully) these applications before continuing to do something.
I am considering getting the handles of each of these files, and then use TerminateProcess to close each one.
Is this graceful? Will it instruct the application to close before deciding to kill the task?
If not is there a better solution?

Thanks,

James
0
Comment
Question by:James Atkin
[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
  • 5
  • 5
10 Comments
 
LVL 24

Accepted Solution

by:
alexey_gusev earned 2000 total points
ID: 26291388
TerminateProcess() is never graceful, it simply kills the process.

I'd try to get their main window's handles and then send them WM_CLOSE message.
0
 
LVL 4

Author Comment

by:James Atkin
ID: 26291423
Sounds more sensible....
What is the best way to do this?
0
 
LVL 24

Expert Comment

by:alexey_gusev
ID: 26291442
you could use EnuWindows() function to get iterated through all top-level windows, collect the handles and window titles (and window classes) - just like you'd see in Spy utility, then you select the desired window and call

SendMessage(hWnd,WM_CLOSE,0,0)

or

PostMessage(hWnd,WM_CLOSE,0,0)
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 4

Author Closing Comment

by:James Atkin
ID: 31675977
Excellent! Thanks for all the help.
Best regards,
James
0
 
LVL 24

Expert Comment

by:alexey_gusev
ID: 26291496
in the prev post: I meant of course EnumWindows()
0
 
LVL 4

Author Comment

by:James Atkin
ID: 26291499
:-) Thanks
0
 
LVL 4

Author Comment

by:James Atkin
ID: 26302188
Me again!

I have just discovered another simple way of doing this:

   Process proc = Process.GetProcessById(ProcessID);
   proc.CloseMainWindow();

This appears to be a nice simple .NET wrapper!

Best regards,

James
0
 
LVL 24

Expert Comment

by:alexey_gusev
ID: 26302254
while it works, that is :)
0
 
LVL 4

Author Comment

by:James Atkin
ID: 26302267
I hope you're not implying that the .NET libraries are not wonderful... hee hee...
0
 
LVL 24

Expert Comment

by:alexey_gusev
ID: 26302719
under Windows Mobile? they're HORRID :)
0

Featured Post

Limited time offer using promo code EXPERTS30

Designed with a wealth of functionality and convenience, ATEN's new Thunderbolt™ 2 Sharing Switch takes your Thunderbolt setup to the next level. Now through September 15, 2017, Experts Exchange members get 30% off the US7220 on the ATEN USA eShop using promo code EXPERTS30.

Question has a verified solution.

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

An introduction to the wonderful sport of Scam Baiting.  Learn how to help fight scammers by beating them at their own game. This great pass time helps the world, while providing an endless source of entertainment. Enjoy!
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
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.
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…
Suggested Courses

777 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