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

x
?
Solved

I can't switch!

Posted on 1999-01-28
4
Medium Priority
?
163 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 600 total points
ID: 1363666
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
ID: 1363667
Or prehaps you could call FindWindow with the caption of your dos program, then ShowWindow or SetForegroundWindow.

Cheers,
Phil

0
 

Author Comment

by:foxvision
ID: 1363668
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
ID: 1363669
No, sorry. "keybd_event" is a win32 function. So you need at least D2.

Regards, Madshi.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Loops Section Overview
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

824 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