Link to home
Start Free TrialLog in
Avatar of Member_2_99151
Member_2_99151

asked on

Closing a group of applications in windows Ce

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
ASKER CERTIFIED SOLUTION
Avatar of alexey_gusev
alexey_gusev
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Member_2_99151
Member_2_99151

ASKER

Sounds more sensible....
What is the best way to do this?
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)
Excellent! Thanks for all the help.
Best regards,
James
in the prev post: I meant of course EnumWindows()
:-) Thanks
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
while it works, that is :)
I hope you're not implying that the .NET libraries are not wonderful... hee hee...
under Windows Mobile? they're HORRID :)