Closing my app...

Hi all

I want to allow other applications, eg MSAccess to close my application programmatically. What is the easiet way to achieve this?

Keith
LVL 1
keithcslAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

keithcslAuthor Commented:
Edited text of question.
0
kretzschmarCommented:
hi keithcsl,

? what about,
that the others app send a simple wm_close message to your mainform-handle (if possible) ?

is your app also started from the other apps?

meikl
0
intheCommented:
you should just make your app as normal.

but one thing to note is if an app send a wm_quit to your app and your app is working with important files or needs to save some settings ,or post data entrys you may want to listen for the wm_quit message and do your stuff and clean up then.if the apps send wm_close these events would be taken care of in your onclose handlers..
you could make something like:

 private
    procedure App_Message(var Msg: TMsg; var Handled: Boolean);

implementation

{$R *.DFM}

procedure TForm1.App_Message(var Msg: TMsg; var Handled: Boolean);
begin
if (Msg.hwnd = application.Handle) and
   (Msg.Message=WM_QUIT) then
begin
    //do clean up stuff
   //save settings etc..
      Handled := True;
    end
else
 Handled := False;  
end;


formcreate event:
 application.onmessage := app_message;

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
intheCommented:
hello..anything further you need?
0
keithcslAuthor Commented:
thanks inthe

sorry i did not get back earlier. it works well...

Keith
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.