Solved

Give the focus to my window

Posted on 1998-12-30
6
159 Views
Last Modified: 2010-04-04
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)
?
0
Comment
Question by:Shellman
6 Comments
 
LVL 5

Accepted Solution

by:
heathprovost earned 50 total points
ID: 1353867
Try this
.....your onclick code here
SetForeGroundWindow(YourForm.Handle);

Hope this helps
0
 
LVL 5

Expert Comment

by:heathprovost
ID: 1353868
Does my solution work? Waiting for a response....
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1353869
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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 10

Expert Comment

by:viktornet
ID: 1353870
You could do this...

MyForm.BringToFront;

or you could do ....

SetActiveForm(Whatever);

-Viktor
--Ivanov
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1353871
actually SetActiveWindow(Whatever); isntead of SetActiveForm(Whatever);
0
 

Author Comment

by:Shellman
ID: 1353872
Thank you. This helps.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…

860 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