Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to autostart your code after form displays?

Status
Not open for further replies.

lsdigital

Programmer
Jan 31, 2006
3
ZA
Hi there,

I wrote a program that start by itself when the FormCreate or FormShow method is invoked. My problem is that the form never shows up until the program code has finished executing. Is there a way that i can show the form and then start the program by itself?

Thanks,

Lohan
 
use a timer and start the program from the OnTimer method...

-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
I did try the timer method. but the form still doesn't show up. the application runs and when all code executed the form shows up? it is an application that download all the details from the users pc with WMI. i need this program to run through a login script and the user must not do anything for the program to run and close. any ideas or sample code?
 
can you show us some code? It would be easier to target the problem...

-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
Post a user message in the mainform OnCreate event.

Code:
...
interface
...

const
  WMU_Running = WM_USER + 100;

TForm1 = class(TForm)
  ...
  private
  ...
  procedure WMURunning(var Msg : TMessage); message WMU_Running;
  ...
  end;

implementation

...

procedure TForm1.FormCreate(Sender: TObject);
  begin
    inherited;
    PostMessage(Handle, WMU_Running, 0, 0);
  end;

procedure TForm1.WMURunning(var Msg : TMessage);
  begin
    {Do whatever is needed.}
  end;
 
buho,

THANKS!!!!

this is exactly what i needed! works like charm!

do one of you maybe know about a nice (FREE) WMI component for Delphi 7?

thanks,

Lohan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top