Solved

select form

Posted on 1998-09-10
10
142 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
  • 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
ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
HTML text in the body of an email (delphi code) 12 120
Downloading email attachments 2 74
delphi parse string to params 3 123
Firemonkey DbLookupComboBox equivalent ? 2 48
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
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…

810 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