Solved

select form

Posted on 1998-09-10
10
140 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
 
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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

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…
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…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

760 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

19 Experts available now in Live!

Get 1:1 Help Now