Solved

Resetting the Focus

Posted on 1997-05-19
3
229 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 20 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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 tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

760 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

22 Experts available now in Live!

Get 1:1 Help Now