Page 1 of 1
Request that another app shuts down.
Posted: Fri Sep 28, 2018 10:19 am
by jassing
Ideally (for me) I want to be able to send a message to another app that mimics a windows-shutdown-message so the app will close its files & exit.
If that's not possible, I can be a shell that runs it, then just terminates it; but I really want to be sure it's file buffers are all flushed .
Any ideas?
thanks.
Re: Request that another app shuts down.
Posted: Fri Sep 28, 2018 10:31 am
by Mijikai
Try to send a close message:
Code: Select all
SendMessage_(WindowHandle.i,#WM_CLOSE,#Null,#Null)
Usually this should work (theres also #WM_QUIT).
Re: Request that another app shuts down.
Posted: Fri Sep 28, 2018 11:24 am
by RASHAD
Hi jassing
Long time no see
Code: Select all
SendMessage_(#HWND_BROADCAST, #WM_SYSCOMMAND, #SC_CLOSE, hWnd)
Re: Request that another app shuts down.
Posted: Sun Sep 30, 2018 4:37 am
by jassing
RASHAD wrote:Hi jassing
Long time no see
Thanks; indeed it has been a while. I moved & took a little time off from Windows work...
Hope you have been well.
RASHAD wrote:
Code: Select all
SendMessage_(#HWND_BROADCAST, #WM_SYSCOMMAND, #SC_CLOSE, hWnd)
Mijikai wrote:Try to send a close message:
Code: Select all
SendMessage_(WindowHandle.i,#WM_CLOSE,#Null,#Null)
Usually this should work (theres also #WM_QUIT).
Thanks; I'll give those three a try. I fear the app I am trying to close gracefully isn't listening. I am trying to close an inventory & billing app down so that it's data file can be backed up at night. The problem is the app doesn't appear to flush its file buffers to disk, so if I kill the app, the data file doesn't contain some of the last updates...
I appreciate the quick replies. Thanks!
Re: Request that another app shuts down.
Posted: Sun Sep 30, 2018 6:29 am
by Dude
I've found the #SC_CLOSE version is better than #WM_CLOSE, because #WM_CLOSE wouldn't close some windows on my PC (but #SC_CLOSE did).
[Edit] Here's my previous post about it:
viewtopic.php?p=509365#p509365
Re: Request that another app shuts down.
Posted: Mon Oct 01, 2018 3:28 am
by jassing
Dude wrote:I've found the #SC_CLOSE version is better than #WM_CLOSE, because #WM_CLOSE wouldn't close some windows on my PC (but #SC_CLOSE did).
I guess it's all a matter of what the app is listening for, conventions are there for a reason, but it doesn't mean apps have to follow them.