Solved

Formless application

Posted on 1998-12-02
8
154 Views
Last Modified: 2010-04-04
I want to create an application that does not have a form.  However,  I want it to make use of the Timer component so that when a certain time is reached it displays a message to the user.  How can this be done ?

I would be grateful for any advice offered regarding this.

John Clarke
0
Comment
Question by:johnclarke
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
8 Comments
 
LVL 3

Accepted Solution

by:
williams2 earned 100 total points
ID: 1348893
Try using this at the Forms OnCreate event:

Application.ShowMainForm:= False;

regards
Williams
0
 

Author Comment

by:johnclarke
ID: 1348894
I tried this in Delphi 1 and unfortunately it does not work.

John
0
 
LVL 3

Expert Comment

by:williams2
ID: 1348895
You are a most Generous guy mr. John Clarke, so I think I'll provide you with an example:

You'll just have to open Delphi, DoubleClick the OnCreate event of Form1, and then cut'n'paste the following lines into unit1:

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ExtCtrls;

type
  TForm1 = class(TForm)
    Timer1: TTimer;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    Timer: TTimer;
    procedure OnTimer(Sender: TObject);
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
begin
  Timer:= TTimer.Create(Self);
  Timer.OnTimer:= OnTimer;
  Timer.Interval:= 10000;
  Timer.Enabled:= True;
  Application.ShowMainForm:= False;
end;

procedure TForm1.OnTimer(Sender: TObject);
begin
  If MessageDlg('Every ten seconds!, should I close now?',
                mtInformation,
                [mbYes,mbNo],
                0)=id_Yes
  Then Application.Terminate;
end;

end.
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 3

Expert Comment

by:williams2
ID: 1348896
You are a most Generous guy mr. John Clarke, so I think I'll provide you with an example:

You'll just have to open Delphi, DoubleClick the OnCreate event of Form1, and then cut'n'paste the following lines into unit1:

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ExtCtrls;

type
  TForm1 = class(TForm)
    Timer1: TTimer;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    Timer: TTimer;
    procedure OnTimer(Sender: TObject);
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
begin
  Timer:= TTimer.Create(Self);
  Timer.OnTimer:= OnTimer;
  Timer.Interval:= 10000;
  Timer.Enabled:= True;
  Application.ShowMainForm:= False;
end;

procedure TForm1.OnTimer(Sender: TObject);
begin
  If MessageDlg('Every ten seconds!, should I close now?',
                mtInformation,
                [mbYes,mbNo],
                0)=id_Yes
  Then Application.Terminate;
end;

end.
0
 
LVL 3

Expert Comment

by:williams2
ID: 1348897
Hmmm.. some error happened above, eh? ..What is the error saying?
0
 
LVL 3

Expert Comment

by:williams2
ID: 1348898
Hmmm.. some error happened above, eh? ..What is the error saying?
0
 
LVL 3

Expert Comment

by:williams2
ID: 1348899
Hmmm.. some error happened above, eh? ..What is the error saying?
0
 
LVL 3

Expert Comment

by:williams2
ID: 1348900
ok, this is a hack! Try it with the forms OnPaint event, or at least after the window is stopped showing (Not OnShow!)

procedure TForm1.FormPaint(Sender: TObject);
begin
  Hide;
end;
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses
Course of the Month3 days, 13 hours left to enroll

630 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