I have written a small application that sends an Email.
I would like it to terminate itself without any user action.
I end the OnCreate procedure with Self.Close, but the application keeps running.
What am i missing?
Sofo
0
Newbie Poster
Recommended Answers
Jump to PostWorst/Quickest/Unelegant method? (assuming you don't just make a console app)
1. Drop a TTimer on the form
2. In the OnTimer event:
Timer1.enabled=false;
SendEmail(); <-- whatever it is you do
self.closeBetter/More elegant: If your email has an event "OnSent" or something, you could call self.close there.
…
Jump to PostThe best way to terminate an application is to call
application.terminate
This prevents a lot of problems and can be called anywhere.Avoid using tTimer as much as possible because it is a "heavy" object --chewing up resources and time.
Hope this helps.
Jump to PostI'd be interested to know why application.terminate didn't stop your program. Have you got unusual hooks in there somewhere? Did your code actually call it?
The problem with the timer is that there is a system limit on the number of timers available. It doesn't matter how big your …
All 9 Replies
bigattichouse
3
Newbie Poster
Sofo
0
Newbie Poster
Duoas
1,025
Postaholic
Featured Poster
Sofo
0
Newbie Poster
Duoas
1,025
Postaholic
Featured Poster
Sofo
0
Newbie Poster
Duoas
1,025
Postaholic
Featured Poster
ExplainThat
1
Junior Poster in Training
Duoas
1,025
Postaholic
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.