[comp.windows.ms] Closing Windows with no user interaction

rkt@bjcong.bj.co.uk (RAKESH TANDON) (02/17/90)

I want to be able to exit out of windows from within my application.
I am aware of FindWindow, GetWindow, and GetNextWindow and posting/
sending each window a WM_CLOSE (???) but the problem is when a
window queries the closedown or if someting like write or notepad
requires some kind of input before closing. Can this be done ?
I don't want any user interaction at all, ie when the closedown starts
from my application thats it nomore windows OK CANCEL etc. Also
I want to close down as tidy as possible.
					 Rakesh Tandon.
-- 
rkt@bj.co.uk
..!mcsun!ukc!pyrltd!bjcong!rkt

balaji@nsc.nsc.com (Balaji Pitchaikani) (02/23/90)

In article <426@bjcong.bj.co.uk> rkt@bjcong.bj.co.uk (RAKESH TANDON) writes:
>I want to be able to exit out of windows from within my application.
>I am aware of FindWindow, GetWindow, and GetNextWindow and posting/
>sending each window a WM_CLOSE (???) but the problem is when a
>window queries the closedown 
        ^^^^^^^^^^^^^^^^^^^^^

	If I have understood correctly, You want to close YOUR
	APPLICATION without any queries from windows. This can be
	easily done by including WM_CLOSE as you have mentioned.
	The sample piece of code will be:-

	  case WM_CLOSE :
		....
		....        /* Getting Ready for Closing application*/
		PostQuitMessage(0);
		break;

	The above code will close that window. If this code is
	available in the main window, this will close your
	application. I prefer a query to be included before
	closing (ie. before PostQuitMessage(0)).

	If you want your program to exit out of windows itself, You
	can try FatalExit(0). 
		   HAS ANYONE TRIED THIS? 
	Is it common to use this function in a standard application. 
	I have used this in our SQA testing version so that we can 
	automate testing.


>or if someting like write or notepad requires some kind of input 
>before closing. Can this be done ?
  
	I am not sure what you are trying to explain about write and
	notepad.

>					 Rakesh Tandon.

balaji
(balaji@nsc.nsc.com)

eav@hpindda.HP.COM (Eugene Veteska) (02/27/90)

I think this was posted a while ago but this is how I shutdown windows
from an application without any user inaction. There is an undocumented
windows function called ExitWindows(). First, you need to forward reference
it:

extern void FAR PASCAL ExitWindows (int, int);

Then call it when you want, like so:

   ExitWindows (NULL, NULL);

I don't know what the parameters mean.  The only danger with this is that if
any applications have not saved their data, it will be lost.  I only use this
function in my test cases, having any easy way to quit windows.  Hope this
helps.


Eugene Veteska
HP Information Networks Division
eav@hpindda.hp.com