[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Bring to Front

Posted on 1998-10-18
6
Medium Priority
?
3,162 Views
Last Modified: 2012-06-27
How can i bring my application written in delphi 1 to the front when another windows has openend in front of mine?
(Method Active doesn't work)
0
Comment
Question by:ponti
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 3

Accepted Solution

by:
philipleighs earned 200 total points
ID: 1343294
Hi,

Add WinTypes and WinProcs to your uses clause.

Use:
SetForeGroundWindow(Form1.Handle);

Cheers,
Phil.

0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1343295
The active property determines whether your application has focus. Use MyMainForm.BringToFront to make your application active again. You could have a check in the OnIdle event handler of the TApplication object to check this automatically and keep your application in the front.

On the other hand, if you have a specific form that you always want to be in front of all the others then set its FormStyle to fsStayOnTop
0
 

Author Comment

by:ponti
ID: 1343296
Both hints don't work. It is not a mdi child within my app, which should be in front of the others. Another app is in front of mine and i would like to bring my app to the front (delphi 1). What works when i set the formstyle to "stayontop". but when i reset the formstyle right after the app goes back to the background.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Expert Comment

by:bryan7
ID: 1343297
hmm... I'm not sure, what happens if you drop a timer and every 4 or 5 seconds
 you set the formstyle as StayOnTop ?

bryan

0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1343298
Have you tried setting the active property to true?
0
 
LVL 3

Expert Comment

by:philipleighs
ID: 1343299
Hi,

I just created a new application in delphi, added a TTimer to the form and set the interval to 3000.

In the OnTimer event I call
SetForeGroundWindow(Application.Handle);

and then run the app. I alt tab to another program, and within 3 seconds the app is brought to the front.

Works for me.

PS:
If your form is minimised then it won't work. If this is the case the call
ShowWindow(Application.Handle, SW_RESTORE);
before SetForeGroundWindow.

PS2:
Prehaps you need Application.Handle, not just Handle which is the main form handle.

Cheers,
Phil.


0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying 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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

656 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