[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Lost Focus after calling another .exe

Posted on 1998-06-20
11
Medium Priority
?
248 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
Industry Leaders: 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 200 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

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

650 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