• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 164
  • Last Modified:

I can't switch!

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
foxvision
Asked:
foxvision
  • 2
1 Solution
 
MadshiCommented:
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
 
philipleighsCommented:
Or prehaps you could call FindWindow with the caption of your dos program, then ShowWindow or SetForegroundWindow.

Cheers,
Phil

0
 
foxvisionAuthor Commented:
Wow! It works in Delphi 4. Can I used it in Delphi 1 as well?

Good Days and Thanks,
0
 
MadshiCommented:
No, sorry. "keybd_event" is a win32 function. So you need at least D2.

Regards, Madshi.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now