Solved

action before shutdown

Posted on 1998-10-27
11
178 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
  • 4
  • 4
  • 2
  • +1
11 Comments
 
LVL 1

Accepted Solution

by:
jecksom earned 50 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
ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

 
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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
delphi parse string to params 3 123
Dev express lookupcombo 3 28
Not able to call Delphi XE10 dll function from Delphi 6.0 4 26
Tidtcpserver listening on multiports? 1 27
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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

777 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