Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2008 May : Application Focuse Problem

www.cryer.info
Managed Newsgroup Archive

Application Focuse Problem

Subject:Application Focuse Problem
Posted by:"Doni Devito" (gurc..@workmail.com)
Date:Thu, 22 May 2008 16:13:40

Hello Everybody.
I have 2 applications, one of them is a version controller. When you run the
application, it checks new versions from a server then executes second
program with shellexecute. Second program askes the password via a dialog.
But second application does not get focus. This is very annoying, when you
want to enter password, you have to first click to the dialog, then enter
password. How can I fix this? How can I set focus manually to application?

Here is the scenerio;
1.Open explorer. The focus is on the explorer.
2.Run First.exe. Exe grabs the focuse as expected.
3.First.exe checks server for new version. Then executes second.exe;
ShellExecute(Handle , 'open', PChar(SecondAppName),MyAppParameters, nil,
SW_NORMAL);
4.Second.exe runs. Before running of second exe, Windows Explorer gets the
focuse again. For this reason password dialog is behind of the explorer
window.
5.Here is Second application source;
    Application.Initialize;
    Application.CreateForm(Tf_MainForm, f_MainForm);// its a trayicon form
    Application.CreateForm(Tf_login, f_login); //login dialog
    Application.ShowMainForm:=False;
    Application.BringToFront;
    Application.HintPause:=0;
    Application.ShowHint:=True;
//here show f_login.<-- Here application must
//according to result show f_mainForm

Any answer?

Regards.

Replies:

www.cryer.info
Managed Newsgroup Archive