Link to home
Start Free TrialLog in
Avatar of Shellman
Shellman

asked on

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)
?
ASKER CERTIFIED SOLUTION
Avatar of heathprovost
heathprovost
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Does my solution work? Waiting for a response....
Avatar of Madshi
Madshi

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.
You could do this...

MyForm.BringToFront;

or you could do ....

SetActiveForm(Whatever);

-Viktor
--Ivanov
actually SetActiveWindow(Whatever); isntead of SetActiveForm(Whatever);
Avatar of Shellman

ASKER

Thank you. This helps.