?
Solved

action before shutdown

Posted on 1998-10-27
11
Medium Priority
?
182 Views
Last Modified: 2010-04-06
My program is 'running' in background
I still want to perform a procedure just before my computer shuts down.
When I put it with
onclose->nothing
ondestroy->sometimes when rebooting
free(redefined)->nothing
release(redefined)->nothing
So, what do I have to do

PS: if this makes it harder? -> I still want to copy a file
0
Comment
Question by:zwarte
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 2
  • +1
11 Comments
 
LVL 1

Accepted Solution

by:
jecksom earned 200 total points
ID: 1344593
Hi , zwarte!

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;

type
  TForm1 = class(TForm)
  private
    procedure WM_ENDSESSION(var msg:TMSG);message WM_ENDSESSION;

    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure Tform1.WM_ENDSESSION(var msg:TMSG);
begin
showmessage('End session');
end;

end.

Jecksom

0
 
LVL 4

Expert Comment

by:BoRiS
ID: 1344594
zwarte

put it in your onclosequery event...

example

begin
 canclose := false;
  Copyfile('c:\autoexec.bat', 'c:\temp\autoexec.bat', false');// false is to override the file if it is already in the directory...
   CanClose := True;
end;

Later
BoRiS
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1344595
zwarte, who are you? If I may ask... I know somebody who calls hime like that.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:jecksom
ID: 1344596
Hi Boris !

My answer doesn't work ? ;)

cya,
Jecksom

0
 
LVL 1

Author Comment

by:zwarte
ID: 1344597
It took a while for me to check this one out but I had a logical mistake somewhere else in the program.
Your answer however works just fine.
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1344598
zwarte, I still would really like who you are, or from where you are , please....
0
 
LVL 1

Author Comment

by:zwarte
ID: 1344599
To Zifnab

From Leuven, so I don't think I'm your guy
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1344600
zwarte, maybe you are. I studied in Leuven and now work in Leuven. Zif. What do you studie or have studied?
0
 
LVL 1

Author Comment

by:zwarte
ID: 1344601
Informatics,
but I Usually don't use the name zwarte
It was the first name that allowed me acces to experts exchange 'cause I was trying to get in with a hotmail adress(this doesn't work), and when I  finally tried my company adres I got in, but under the name of zwarte.
I do however know a guy that went by the name of Zwarte Fons, but not just zwarte
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1344602
Well, then your not the guy I know of. Pitty, because we've lot's to discuss. The guy I know calls him Black, but I thought he maybe changed it to zwarte.
Have a nice day and thanks for responding.
0
 
LVL 1

Author Comment

by:zwarte
ID: 1344603
Your welcome
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question