Solved

Lost Focus after calling another .exe

Posted on 1998-06-20
11
243 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

695 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