how to activate program's main from after a time t seconds ?

i have got a database with 2 fields,
Date and Time. I want my program's main form to be hidden untill date and time is equel to those in the database.

My problem is that I cannot dynamically create my mainform when the time occurs.

Any help is appreciated.

Thanks
LVL 1
drnadeemAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

zwarteCommented:
hi drnadeem,

form1.hide
form1.show

tom,
0
manjushanCommented:
Hi,
   Put a timmer component. And in the on timmer event check for the date and time of your database. Then u can do the above. form1.hide or Form1.Show.
       All the best.
            Manju.
                             
                       
0
AttarSoftwareCommented:
in Main forms {Private} section :

  procedure WMHIDE( var msg : tMessage ) ; message WM_USER + 1 ;

and then in Implementation section :

procedure tForm1.WMHIDE( var msg : tMessage ) ;
begin
  ShowWindow( Application.Handle, SW_HIDE ) ;
  ShowWindow( Handle, SW_HIDE ) ;
end ;

and in the OnShow event of your main form :

procedure tForm1.FormShow( sender : tObject ) ;
begin
  PostMessage( handle, WM_USER + 1, 0, 0 ) ;
end ;

and then :

procedure TForm1.Timer1Timer( sender : tObject ) ;
begin
  if( TimesMatchFunction ) then
  begin
    ShowWindow( Application.Handle, SW_SHOW ) ;
    ShowWindow( Handle, SW_SHOW ) ;
  end ;
end ;

Obviously, you'll have to write the TimesMatchFunction function ;O)

Good luck

Tim.
 
0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

AttarSoftwareCommented:
Oh yeah, and you'll have to add Timer1 to the main form too :)

(as Manju said -- hee hee, that comment came in whilst I was typing ;O) )

Tim.
0
zwarteCommented:
functions to use
function date: tdatetime
function time: tdatetime
timetostr(tdatetime):string
datetostr(tdatetime):string
comparestr(str1,str2 : string):integer

apparently I missed part of the question due to a lack of attention, but its been a boring day so I just thought I'd spare you some lookup work :-)

Tom,
0
Ten13Commented:
To start your application totally invisible you have to do this:

In your project file (.dpr) add one line of code:
  Application.Initialize; (*already there*)
  Application.CreateForm(TfrmMain, frmMain); (*already there*)
  Application.ShowMainForm:= false; (*add this line*)
  Application.Run; (*already there*)

In you main form "FormCreate" event add this:
procedure TForm1.FormCreate(Sender: TObject);
begin
  ShowWindow(Application.Handle, SW_HIDE);  (*add this line*)
end;

When you want to display your application and mainform (propably with a timer) do this:
procedure TfrmMain.Timer1Timer(Sender: TObject);
begin
  if ConditionsToDisplayApplicationIsOK then begin
    ShowWindow(Application.Handle, SW_SHOW);  (*add this line*)
    Visible:= true;  (*add this line*)
  end;
end;

That's it. No more, no less. Hope it is what you're looking for.

- Martin
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.