Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Resetting the Focus

Posted on 1997-05-19
3
Medium Priority
?
255 Views
Last Modified: 2010-04-04
How do you set the focus to a dos program in delphi. The dos program is already running, but minimized.
0
Comment
Question by:Deep Diver
  • 2
3 Comments
 

Author Comment

by:Deep Diver
ID: 1336455
Edited text of question
0
 

Accepted Solution

by:
kangadru earned 40 total points
ID: 1336456
You have to use 2 API calls.  Depending on if you want to deal with Minimized or not, I prefer not to maximize minimized windows as a rule, but there are exceptions.In the Following Ex. The FindWindow Call uses the Title Bar name of the Window to find a Window HAndle and the Show Window to restore it  and give it the focus.  Commented out you'll see SetForeGround Window, that's my preferance as it does not restore the window and does not preempt the keyboard input. it only sets that window active.A third method would be to use SetWindowPos() and you can make it TopMost with out bringin it forward to the top of the ZOrder.var
  theHAndle : HWND;
begin
  theHandle := FindWindow(nil, 'Bash');
//  setForeGroundWindow(theHandle);
  ShowWindow(theHandle, SW_SHOWNORMAL);
end;
Andy
0
 

Author Comment

by:Deep Diver
ID: 1336457
Type the showWindow Command two times...Once is not anough
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
Screencast - Getting to Know the Pipeline
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

916 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