Solved

I can't switch!

Posted on 1999-01-28
4
157 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
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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Virtuailstring tree compare node issue 14 125
code issue 8 156
Find and Replace Stream with 0s 8 69
Firemonkey webbrowser scrollbars ? 1 50
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

830 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