Solved

action before shutdown

Posted on 1998-10-27
11
176 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
Comment Utility
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
Comment Utility
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
Comment Utility
zwarte, who are you? If I may ask... I know somebody who calls hime like that.
0
 
LVL 1

Expert Comment

by:jecksom
Comment Utility
Hi Boris !

My answer doesn't work ? ;)

cya,
Jecksom

0
 
LVL 1

Author Comment

by:zwarte
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 8

Expert Comment

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

Author Comment

by:zwarte
Comment Utility
To Zifnab

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

Expert Comment

by:ZifNab
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Your welcome
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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…
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…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

771 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now