Solved

Lost Focus after calling another .exe

Posted on 1998-06-20
11
241 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
ID: 1354612
Is that other program is a Delphi program?
0
 
LVL 3

Author Comment

by:jdthedj
ID: 1354613
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
ID: 1354614
try
SetForegroundWindow(Handle)
or
SetActiveWindow(Handle)
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 3

Expert Comment

by:Matvey
ID: 1354615
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
ID: 1354616
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
 
LVL 3

Expert Comment

by:Matvey
ID: 1354617
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
ID: 1354618
FIND:                 E9 40 01 E9 3D
CHANGE TO:   E9 3C 01 E9 3D
                                 ^^
0
 
LVL 3

Expert Comment

by:Matvey
ID: 1354619
0
 
LVL 2

Expert Comment

by:hrizal
ID: 1354620
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
ID: 1354621
Hi, Glad I could help!
0
 
LVL 3

Author Comment

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

Thanks Matvey for your help
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

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…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

792 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