Mitsy
asked on
select form
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
I use delphi 1. thanx
Mits
ASKER
no the form does not have focus and remains hidden under other apps, when i double click the icon.
Mits
Mits
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You could also use this......
FormName.BringToFront;
Regards,
Viktor Ivanov
FormName.BringToFront;
Regards,
Viktor Ivanov
ASKER
It doesnt work it still does not have focus, i think focus has been given to the icon in the tray
Mits
Mits
It depends on where do you call that......Did you try in OnShow()
ASKER
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
i can now bring the form to front with setWindowPos in win API but still cant give focus, the title bar is greyed.
Mitsy
Would you please send me the project so I can take a loot at it???
ASKER
ok i will
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
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
In the OnResize event of this form, put FORM1.ACTIVATE;
I think this should do it.