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
Solved

Formless application

Posted on 1998-12-02
8
151 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
  • 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Suggested Solutions

Title # Comments Views Activity
delphi prevent click fast 2 238
Printing problem 2 101
Delphi XE10 Round Image 2 154
how to make 2 step back? ..\..\ ExtractFilePath (paramstr(0)) 5 45
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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

789 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