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
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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)
SendMessage(hWnd,WM_CLOSE,
or
PostMessage(hWnd,WM_CLOSE,
ASKER
Excellent! Thanks for all the help.
Best regards,
James
Best regards,
James
in the prev post: I meant of course EnumWindows()
ASKER
:-) Thanks
ASKER
Me again!
I have just discovered another simple way of doing this:
Process proc = Process.GetProcessById(Pro cessID);
proc.CloseMainWindow();
This appears to be a nice simple .NET wrapper!
Best regards,
James
I have just discovered another simple way of doing this:
Process proc = Process.GetProcessById(Pro
proc.CloseMainWindow();
This appears to be a nice simple .NET wrapper!
Best regards,
James
while it works, that is :)
ASKER
I hope you're not implying that the .NET libraries are not wonderful... hee hee...
under Windows Mobile? they're HORRID :)
ASKER
What is the best way to do this?