www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/08/20/01:16:46

From: Endlisnis <s257m AT unb DOT ca>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Can a DOS Console App close its own window?
Date: Sun, 16 Aug 1998 00:38:20 -0300
Organization: NBTel Internet
Lines: 43
Message-ID: <35D6542B.51220CF2@unb.ca>
References: <1998081520504700 DOT QAA04276 AT ladder01 DOT news DOT aol DOT com>
NNTP-Posting-Host: fctnts09c44.nbnet.nb.ca
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

OoHOSEoO wrote:

> Hello,  I was wondering if there is a way I can have a DOS Console application
> close its own window when run through Windows... I am aware of the "Close On
> Exit" feature of Windows' short-cuts, but that only helps me so much.
> I'd appreciate any suggestions.

I actually found a way to do this in a 16-bit application.  I tried to convert it
into DJGPP and it gave confusing results.  I've been told that explicitely writing

int main()
{
 asm ("int $0x19;");
 }
was effectively the same as
#include <dpmi.h>
#include <string.h>

int main()
{
 __dpmi_regs Regs;
 memset(&Regs, 0, sizeof(Regs));
 __dpmi_int(0x19, &Regs);
 }

But these 2 programs run differently.  These call interrupt #19, which is supposed
to reboot the computer, apparently Win95 catches this and just closes the DOS
Box.  This is a trick I used to use in Borland C++.  The first example works as I
expected, whenever you with to end your program AND the DOS box your in, just put
a line:
 asm ("int $0x19;");
and the DOS box will close, if you are in real dos, your machine will reboot.  I
am confused by the way the __dpmi_int call works differently though, it locks the
machine for about 5 seconds then a window pops up saying the application has ended
improperly and must be restarted.  What does __dpmi_int do that is different?

--
     (\/) Endlisnis (\/)
          s257m AT unb DOT ca
          Endlisnis AT GeoCities DOT com
          Endlis AT nbnet DOT nb DOT ca


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019