Solved

Lost Focus after calling another .exe

Posted on 1998-06-20
11
237 Views
Last Modified: 2010-04-04
Hi

I have written an Installation program which calls another program (.exe), but when the other program closes, my program has disappeared behind all the open programs.  I have tried setting the FormStyle to fsStayOnTop, which it does, but all the components on the form for some reason become invisible, and I can't even close the program.

My question is, How do I get my program to come to the front after the called program has finished.
0
Comment
Question by:jdthedj
  • 5
  • 3
  • 2
  • +1
11 Comments
 
LVL 5

Expert Comment

by:ronit051397
Comment Utility
Is that other program is a Delphi program?
0
 
LVL 3

Author Comment

by:jdthedj
Comment Utility
Hi Ronit - thanks for the reply.

I've just realised that it is not actually calling the .exe because it is a 16 bit ap - the .exe is for installations to Win95 etc.  It is creating a Program Group via DDE, and when the group has been created that stays open, which I want it to, but the Installation program has disappeared behind Program Manager.

I want it to keep the focus.
0
 
LVL 5

Expert Comment

by:ronit051397
Comment Utility
try
SetForegroundWindow(Handle)
or
SetActiveWindow(Handle)
0
 
LVL 3

Expert Comment

by:Matvey
Comment Utility
Hi jdthedj,

You can execute the exe, get notified when it's finished and then bring your app to top (focuse).

There are components that ease this task very much (exe calliing) - I can send you one so post your email.

bosism@netvision.net.il
0
 
LVL 3

Author Comment

by:jdthedj
Comment Utility
Hi again Ronit - I tried both of those, but no joy. I also tried BringWindowToTop.

Hi Matvey -  thanks for replying. I am using D1 and WIN 3.11.  My email address is johnd@caverock.net.nz
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 3

Expert Comment

by:Matvey
Comment Utility
I'll send you two components. The first one is better but it's meant for win32, though there were previous releases and you should contact the author to ask for them if you need them because I think he has no site of his own. But you can find his email inside.

The seccond component is meant both for D1 and D2, and inclued examples for both versions. But I also find this and you should really check it out:

"If you use 16bits version of this component with Delphi 1.0 and wait for
termination of application , you may find that your application can not
be activated again. This is because of limitation of Windows. You can
edit Delphi's debug DLL to avoid this problem. PASDBK16.DLL is located
at DELPHI\BIN, and:

FIND:               E9 40 01 E9 3D
CHANGE TO:   E9 3C 01 E9 3D
                             ^^

-this is a quote from the readme for the seccond component, so it might be the problem...

So tell me what you find. btw: I have also D1 installed, but it's under win32 so it'll be not much help with testing...
0
 
LVL 3

Expert Comment

by:Matvey
Comment Utility
FIND:                 E9 40 01 E9 3D
CHANGE TO:   E9 3C 01 E9 3D
                                 ^^
0
 
LVL 3

Expert Comment

by:Matvey
Comment Utility
0
 
LVL 2

Expert Comment

by:hrizal
Comment Utility
or ...

Begin
   form1.hide;
   ExecFile('bla .. bla ....');
   form1.show;
end;

or

begin
   WinExec('C:\TEST.EXE',SW_HIDE'); // sometimes not work.
   If Not form1.showing then Form1.Show;
end;
0
 
LVL 3

Accepted Solution

by:
Matvey earned 50 total points
Comment Utility
Hi, Glad I could help!
0
 
LVL 3

Author Comment

by:jdthedj
Comment Utility
Hi Hrizal - Thanks for replying - I have tried that too, but without success.

Thanks Matvey for your help
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

762 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

9 Experts available now in Live!

Get 1:1 Help Now