Thread View: comp.lang.pascal.delphi.misc
4 messages
4 total messages
Started by Chow Hoi Ka, Eric
Thu, 27 May 1999 00:00
How to prevent CLOSE program ?
Author: Chow Hoi Ka, Eric
Date: Thu, 27 May 1999 00:00
Date: Thu, 27 May 1999 00:00
12 lines
1187 bytes
1187 bytes
Hello, Is it possible to prevent close other program ? Such as that, my program A will be started in background, and is listening for some events. And the main function is to prevent closing the program B. How to do this ? Best regards, Eric
Re: How to prevent CLOSE program ?
Author: Matthias Thiel
Date: Thu, 27 May 1999 00:00
Date: Thu, 27 May 1999 00:00
27 lines
1545 bytes
1545 bytes
Chow Hoi Ka, Eric schrieb in Nachricht <374D0BF9.20262D91@sftw.umac.mo>... >Hello, > >Is it possible to prevent close other program ? > >Such as that, my program A will be started in background, and is >listening for some events. And the main function is to prevent closing >the program B. > >How to do this ? > >Best regards, >Eric > Hmm... The easiest way would be to modify program B not to be closed. For this you can use the OnCloseQuery event. (Just set CanClose to false). To make program A able to prevent program B from closing would mean to capture all close messages addressed to program B. This can be done by a windows hook but I ave no experiences in it. If you just want to restart program B if it is terminated a search with GetNextWindow or FindWindow could be a way... Hth, Matthias.
Re: How to prevent CLOSE program ?
Author: Sonnich Jensen
Date: Thu, 27 May 1999 00:00
Date: Thu, 27 May 1999 00:00
39 lines
1958 bytes
1958 bytes
Not excatly what you're searching for, but I made something like that once. I have a program start a 'child-program', where the parent can't be close until the child returns it close message to the parent. You can use the TApplication.OnAppMessage (correct name ???) to capture all messages, and the FindWindow to get the handle of another window if you know its classname and caption. MyHandle := FindWindow(blah blah) PostMessage( MyHandle, WM_USER+whatever, data...) and use the AppMessage to capture these telling whether it can close or not. Not that if yuo set the Handled paramater to True, then the message will not be carried out. As I don't know what specifications yuo excatly have I don't know whether this helps you. Hopefylly it gives a hint or idea. See http://homestead.dejanews.com/user.sonnich/files/child.zip as an example. God luck with it ! S. Chow Hoi Ka, Eric wrote in message <374D0BF9.20262D91@sftw.umac.mo>... >Hello, > >Is it possible to prevent close other program ? > >Such as that, my program A will be started in background, and is >listening for some events. And the main function is to prevent closing >the program B. > >How to do this ? > >Best regards, >Eric >
Re: How to prevent CLOSE program ?
Author: Matija Polajnar
Date: Thu, 27 May 1999 00:00
Date: Thu, 27 May 1999 00:00
20 lines
1241 bytes
1241 bytes
In pascal (DOS) I used "exitproc". Type "exitproc" somewhere and press F1 and you will see...... the magic :). Matija Chow Hoi Ka, Eric <d951686@sftw.umac.mo> wrote in message news:374D0BF9.20262D91@sftw.umac.mo... | Hello, | | Is it possible to prevent close other program ? | | Such as that, my program A will be started in background, and is | listening for some events. And the main function is to prevent closing | the program B. | | How to do this ? | | Best regards, | Eric |
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads