Board index » delphi » D2: Preventing formless app from taking focus

D2: Preventing formless app from taking focus

Hello,

I'm writing an application that does some background-work. That's why it's
formless, it doesn't need any. The problem I have is that, when run, it takes
focus, though it shouldn't do that.

I found out about it taking focus when I was playing a DOS-game in Windows95,
and was thrown back to Windows for no obvious reason. It appeared to be my app
(had it run from my www-server).

Can anybody tell me how to REALLY hide this app ? (eg prevent it from
receiving focus, though it'll still run).

Thanks in advance.
Alban Hertroys.

 

Re:D2: Preventing formless app from taking focus


In article <50pbm9$...@dinkel.civ.utwente.nl>, A.G.Hertro...@student.utwente.nl
says...

Quote

>Hello,
>Can anybody tell me how to REALLY hide this app ? (eg prevent it from
>receiving focus, though it'll still run).

Did you compile it as a Console app? look in the options setup for the project.

--
Greg Carter, Electrical Engineer
CRYPTOCard Corporation
gr...@cryptocard.com

Re:D2: Preventing formless app from taking focus


On 6 Sep 1996 14:15:37 GMT, A.G.Hertro...@student.utwente.nl (Alban

Quote
Hertroys) wrote:
>Hello,

>I'm writing an application that does some background-work. That's why it's
>formless, it doesn't need any. The problem I have is that, when run, it takes
>focus, though it shouldn't do that.

>I found out about it taking focus when I was playing a DOS-game in Windows95,
>and was thrown back to Windows for no obvious reason. It appeared to be my app
>(had it run from my www-server).

>Can anybody tell me how to REALLY hide this app ? (eg prevent it from
>receiving focus, though it'll still run).

I don't know exactly what you're doing. It seems that you create a
window sometime during execution. If you use any VCL then there is the
VCL to do this for you (yes this hidden window for the Application
object). That immediately takes focus to your app and even prevents
you to preserve the old Active window with the first statement in your
Project-source (funny it is somewhere in the initialization code for
this VCL-source). You can turn this behaviour off by doing this:

Create a new unit which looks like:

unit first;

interface

implementation

initialization
  IsLibrary := True;
end.

and make this the first used unit in your project source. This makes
the VCL think it is in a DLL and so there is no auto-created window.

You have to test, if there are side-effects.

Hope this helps
Meikel Weber
m.we...@public.ndh.com
Make sure you visit my homepage
http://ourworld.compuserve.com/Homepages/meikel

Other Threads