Rene
2008-07-27 18:19:18 UTC
Hello to all of You!
I am having a problem I can't find a solution to anywhere on the web. I want
a window to open when the user of my program closes the exit border icon (X)
or "Close" in the menu on the left top of the window (the menu that drops
from the icon I mean) or ALT-F4. The window should be of the same type as
when You close a document in e.g. OOo (ask to save or cancel, You'll know
what I mean). The window itself is not that important but capturing the
close command and preventing the program from closing if the user decides to
cancel and actually allowing it to close if he/she decides that is OK is
what I can't achieve.
What I did find was this single webpage
http://www.daniweb.com/forums/thread42668.html where the writer wrote:
void __fastcall TMainForm::ExitClick(TObject *Sender)
{
Application->MessageBox("Are you sure you want to exit?",
"Confirmation", MB_OKCANCEL);
Application->Terminate( );
}
I can adjust the messagebox, that is not the problem. However, I have no
clue where to paste this code...
I have changed the TMainForm into TForm1 and put it in my .c file and a
prototype into the .h file but that does not make a thing happen differently
than before I did that. What/where is the mainform?
The writer also wrote: "How do i keep the program from executing the
Terminate() function? I am not sure how i capture and use the return value
that the button click on the message box produces."
And then later he added a post that said: "I figured it out, thanks any
way." Unfortunately he did not write down how he did.
I am just a starter (having just finished my beginners course), I would be
extremely greatfull if someone might help me out on this one, it is
important for my first real assignment for a friend, not paid work but it
will be used for something "real" ;-), it is part of a quiz he is organizing
for the day out he is having with his colleagues.
Thank You very much in advance!
Yours sincerely,
Rene
I am having a problem I can't find a solution to anywhere on the web. I want
a window to open when the user of my program closes the exit border icon (X)
or "Close" in the menu on the left top of the window (the menu that drops
from the icon I mean) or ALT-F4. The window should be of the same type as
when You close a document in e.g. OOo (ask to save or cancel, You'll know
what I mean). The window itself is not that important but capturing the
close command and preventing the program from closing if the user decides to
cancel and actually allowing it to close if he/she decides that is OK is
what I can't achieve.
What I did find was this single webpage
http://www.daniweb.com/forums/thread42668.html where the writer wrote:
void __fastcall TMainForm::ExitClick(TObject *Sender)
{
Application->MessageBox("Are you sure you want to exit?",
"Confirmation", MB_OKCANCEL);
Application->Terminate( );
}
I can adjust the messagebox, that is not the problem. However, I have no
clue where to paste this code...
I have changed the TMainForm into TForm1 and put it in my .c file and a
prototype into the .h file but that does not make a thing happen differently
than before I did that. What/where is the mainform?
The writer also wrote: "How do i keep the program from executing the
Terminate() function? I am not sure how i capture and use the return value
that the button click on the message box produces."
And then later he added a post that said: "I figured it out, thanks any
way." Unfortunately he did not write down how he did.
I am just a starter (having just finished my beginners course), I would be
extremely greatfull if someone might help me out on this one, it is
important for my first real assignment for a friend, not paid work but it
will be used for something "real" ;-), it is part of a quiz he is organizing
for the day out he is having with his colleagues.
Thank You very much in advance!
Yours sincerely,
Rene