Solved

Give the focus to my window

Posted on 1998-12-30
6
157 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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
how to center only a line in richedit? 4 56
Correct Component for Shopping Cart. 2 104
SUM 2 INTEGER ARRAYS INTO 1 10 99
Tvertscrollbox like a whatsapp layout delete messages 1 16
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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

816 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now