Solved

select form

Posted on 1998-09-10
10
145 Views
Last Modified: 2010-04-06
i have a icon in the system tray for my application when i double click the icon the to show the app it shows but the other apps still have focus.How cani give the form and bring to top. I tried setfocus and topmostWindow  in windows API.
I use delphi 1. thanx
Mits
0
Comment
Question by:Mitsy
[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
  • 5
  • 4
10 Comments
 

Expert Comment

by:belgianbasman
ID: 1339223
Suppose the form you want to show up is called FORM1.

In the OnResize event of this form, put FORM1.ACTIVATE;

I think this should do it.

0
 

Author Comment

by:Mitsy
ID: 1339224
no the form does not have focus and remains hidden under other apps, when i double click the icon.
Mits
0
 
LVL 10

Accepted Solution

by:
viktornet earned 50 total points
ID: 1339225
SetForegroundWindow(FormName.Handle);

Regards,
Viktor Ivanov
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 10

Expert Comment

by:viktornet
ID: 1339226
You could also use this......

FormName.BringToFront;

Regards,
Viktor Ivanov
0
 

Author Comment

by:Mitsy
ID: 1339227
It doesnt work it still does not have focus, i think focus has been given to the icon in the tray
Mits
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1339228
It depends on where do you call that......Did you try in OnShow()
0
 

Author Comment

by:Mitsy
ID: 1339229
hey viktornet
i can now bring the form to front with setWindowPos in win API but still cant give focus, the title bar is greyed.
Mitsy
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1339230
Would you please send me the project so I can take a loot at it???
0
 

Author Comment

by:Mitsy
ID: 1339231
ok i will
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1339232
I sent you some suggestions........You could also try this.....

public
  Procedure ActiveApp(Sender : TObject);
{...}
In OnCreate() enter this code...
Application.OnActivate := ActiveApp;
//The code for the AcitveApp() procedure...
procedure TForm1.ActiveApp(Sender : TObject);
begin
  if Visible then
    Hide
  else
  begin
    if not(GetForegroundWindow = Handle) then
      SetForegroundWindow(Handle);
  end;
end;

Try this if the suggestions I gave you don't work....

Regards,
Viktor Ivanov
0

Featured Post

Industry Leaders: 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!

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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

707 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