Solved

action before shutdown

Posted on 1998-10-27
11
180 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
Technology Partners: 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

733 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