Give the focus to my window

How can I get a window of my program to the front (When I click on the tray icon my program should come to the front)
?
ShellmanAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
heathprovostConnect With a Mentor Commented:
Try this
.....your onclick code here
SetForeGroundWindow(YourForm.Handle);

Hope this helps
0
 
heathprovostCommented:
Does my solution work? Waiting for a response....
0
 
MadshiCommented:
You should call
  SetForegroundWindow(Application.Handle);
and
  Application.ProcessMessages;
before displaying anything like popup menus. Only these two commands in this order will make sure that everything is fine...

Regards, Madshi.
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
viktornetCommented:
You could do this...

MyForm.BringToFront;

or you could do ....

SetActiveForm(Whatever);

-Viktor
--Ivanov
0
 
viktornetCommented:
actually SetActiveWindow(Whatever); isntead of SetActiveForm(Whatever);
0
 
ShellmanAuthor Commented:
Thank you. This helps.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.