Solved

I can't switch!

Posted on 1999-01-28
4
153 Views
Last Modified: 2010-04-06
I have a DOS Pascal program running in MS-DOS Full Screen Mode. And this DOS program calls a Windows Delphi program.

After closing the Delphi program, the screen remains in Windows and I have to press ALT-TAB to switch back to DOS Full Screen Mode. This, of course, does not happen when I execute the DOS program in Window(Not Full Screen) MS-DOS Mode.

My question is, is it possible to, say using SendMessage(...), to maximize a full screen MS-DOS window, instead of having me pressing ALT-TAB? I've tried but failed...*sigh*

Any hint?
0
Comment
Question by:foxvision
  • 2
4 Comments
 
LVL 20

Accepted Solution

by:
Madshi earned 150 total points
Comment Utility
Hi foxvision,

try this one:

procedure PressAltTab;
begin
  keybd_event(VK_MENU,0,0,0);
  keybd_event(VK_TAB, 0,0,0);
  keybd_event(VK_TAB, 0,KEYEVENTF_KEYUP,0);
  keybd_event(VK_MENU,0,KEYEVENTF_KEYUP,0);
end;

Regards, Madshi.
0
 
LVL 3

Expert Comment

by:philipleighs
Comment Utility
Or prehaps you could call FindWindow with the caption of your dos program, then ShowWindow or SetForegroundWindow.

Cheers,
Phil

0
 

Author Comment

by:foxvision
Comment Utility
Wow! It works in Delphi 4. Can I used it in Delphi 1 as well?

Good Days and Thanks,
0
 
LVL 20

Expert Comment

by:Madshi
Comment Utility
No, sorry. "keybd_event" is a win32 function. So you need at least D2.

Regards, Madshi.
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

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…
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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
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.

743 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

16 Experts available now in Live!

Get 1:1 Help Now