Grupos de Google ya no admite nuevas publicaciones ni suscripciones de Usenet. El contenido anterior sigue siendo visible.

running in dos box?

Visto 0 veces
Saltar al primer mensaje no leído

Kris

no leída,
5 ago 2000, 3:00:005/8/00
a
Is there a way with QuickBasic to tell if the program is being ran in a
Windows DOS box?

WDS

no leída,
7 ago 2000, 3:00:007/8/00
a
On Sat, 5 Aug 2000 05:38:59 -0500, Kris wrote:

>Is there a way with QuickBasic to tell if the program is being ran in a
>Windows DOS box?

You could try something like SHELL "VER > MYFILE.VER", and then open
and examine the contents of MYFILE.VER. If it contains "Win" as part
of the version, then it is running under Windows.

On some systems, you may have an environment variable such as "windir"
set, but this is a less reliable indicator.


Andreas Meile

no leída,
8 ago 2000, 3:00:008/8/00
a
"WDS" <W...@WDS.WDS.5> schrieb im Newsbeitrag
news:398f1ff7...@news1.frb.gov...

> On Sat, 5 Aug 2000 05:38:59 -0500, Kris wrote:
>
> On some systems, you may have an environment variable such as "windir"

=> this allows you to write

IF ENVIRON$("windir")="" THEN
PRINT "We are in *pure* DOS"
ELSE
PRINT "Windows is running"
END IF

About QuickBASIC and operating systems in general, look at

http://dreael.catty.ch/Deutsch/BASIC-Knowhow-Ecke/EinbettungBSY.html

section "Zugriff auf Umgebungsvariablen".

Note that I'm still working on this new BASIC knowhow corner, a French and
English translation will follow later, so please use
http://babelfish.altavista.com/translate.dyn at the moment if you don't
speak German.

Benefit of this way: It is very easy to implement and work also in
QBASIC.EXE (shipped in MS-DOS 5.x/6.x) as well as in the old GWBASIC.EXE.

But big drawback: It's a very *unreliable* way because Windows 3.1 does
*not* set the windir variable and a SET windir=foobar in the AUTOEXEC.BAT
will trick out (producing a *wrong* result!) this program.

Conclusion for you: It's recommended to work with CALL INTERRUPT as shown in
my other posting because this is an *official* way recommended by Microsoft.

Andreas

Andreas Meile

no leída,
8 ago 2000, 3:00:008/8/00
a
"Kris" <aun...@geneseo.net> schrieb im Newsbeitrag
news:8mgqql$40qe$1...@news3.infoave.net...

> Is there a way with QuickBasic to tell if the program is being ran in a
> Windows DOS box?

Check out

http://support.microsoft.com/support/kb/articles/Q75/3/38.ASP

In QuickBASIC, you need the compiler version due the CALL INTERUPTs,
QBASIC.EXE shipped with MS-DOS 5.x/6.x and \TOOLS\OLDMSDOS does *not* work.
I translated that assemby program in the article above into a BASIC program.

Note: Start QB.EXE with "qb /l qb"!

' Checking if we are running in MS-DOS prompt under Windows
' This programm corresponents to
' http://support.microsoft.com/support/kb/articles/Q75/3/38.ASP

' $INCLUDE: 'qb.bi'

DIM dosIntEin AS RegTypeX, dosIntAus AS RegTypeX

dosIntEin.ax = &H160A
CALL INTERRUPTX(&H2F, dosIntEin, dosIntAus)
IF dosIntAus.ax = 0 THEN
' We are in Windows 3.1
PRINT "We are running Windows version"; dosIntAus.bx \ 256; ".";
dosIntAus.bx AND 255
SELECT CASE dosIntAus.cx
CASE 2
PRINT "We are in standard mode"
CASE 3
PRINT "We are in enhanced mode"
CASE ELSE
PRINT "We are in an unknown mode"
END SELECT
ELSE
dosIntEin.ax = &H1600
CALL INTERRUPTX(&H2F, dosIntEin, dosIntAus)
IF (dosIntAus.ax AND &H7F) <> 0 THEN
PRINT "Windows 3.0 Enhanced mode is running"
ELSE
dosIntEin.ax = &H4680
CALL INTERRUPTX(&H2F, dosIntEin, dosIntAus)
IF dosIntAus.ax = 0 THEN
dosIntEin.ax = &H4B02
dosIntEin.bx = 0
dosIntEin.di = 0
dosIntEin.es = 0
CALL INTERRUPTX(&H2F, dosIntEin, dosIntAus)
IF dosIntAus.ax = 0 THEN
PRINT "We are in the *pure* MS-DOS"
ELSE
dosIntEin.ax = &H1605
CALL INTERRUPTX(&H2F, dosIntEin, dosIntAus)
IF dosIntAus.cx = -1 THEN
PRINT "We are in Windows 3.0 standard mode"
ELSE
dosIntEin.ax = &H1606
CALL INTERRUPTX(&H2F, dosIntEin, dosIntAus)
PRINT "We are in Windows 3.0 real mode"
END IF
END IF
ELSE
PRINT "We are in the *pure* MS-DOS"
END IF
END IF
END IF

Note: Windows 95 reports version 4.00, 95 Rev. B reports 4.03 and Windows 98
(original *before* the second edition) reports 4.10. WfW 3.11 reports 3.11
of course. :-)

Windows NT 4.0 (Workstation, Service Pack 6a) seems to behave very
interesting: *pure* DOS?!?

Especially for you: It's recommended to convert this into a FUNCTION
procedure like this one:

' Checking if we are running in MS-DOS prompt under Windows
' This programm corresponents to
' http://support.microsoft.com/support/kb/articles/Q75/3/38.ASP

' $INCLUDE: 'qb.bi'

FUNCTION WindowsIsRunning%
DIM dosIntEin AS RegTypeX, dosIntAus AS RegTypeX

dosIntEin.ax = &H160A
CALL INTERRUPTX(&H2F, dosIntEin, dosIntAus)
IF dosIntAus.ax = 0 THEN
WindowsIsRunning% = -1
ELSE
dosIntEin.ax = &H1600
CALL INTERRUPTX(&H2F, dosIntEin, dosIntAus)
IF (dosIntAus.ax AND &H7F) <> 0 THEN
WindowsIsRunning% = -1
ELSE
dosIntEin.ax = &H4680
CALL INTERRUPTX(&H2F, dosIntEin, dosIntAus)
IF dosIntAus.ax = 0 THEN
dosIntEin.ax = &H4B02
dosIntEin.bx = 0
dosIntEin.di = 0
dosIntEin.es = 0
CALL INTERRUPTX(&H2F, dosIntEin, dosIntAus)
WindowsIsRunning% = dosIntAus.ax <> 0
ELSE
WindowsIsRunning% = 0
END IF
END IF
END IF
END FUNCTION

' Main program

IF WindowsIsRunning THEN
' Stuff in Windows
ELSE
' Stuff in *pure* DOS
END IF

Andreas


Kurt McKee

no leída,
13 ago 2000, 3:00:0013/8/00
a
On Mon, 07 Aug 2000 20:46:00 GMT, W...@WDS.WDS.5 (WDS) wrote:

>On Sat, 5 Aug 2000 05:38:59 -0500, Kris wrote:
>

>>Is there a way with QuickBasic to tell if the program is being ran in a
>>Windows DOS box?
>

>You could try something like SHELL "VER > MYFILE.VER", and then open
>and examine the contents of MYFILE.VER. If it contains "Win" as part
>of the version, then it is running under Windows.
>

>On some systems, you may have an environment variable such as "windir"

>set, but this is a less reliable indicator.
>

actually, in my tests, the "windir" variable only exists when windows
is running, although "winbootdir" exists regardless. you can test by
using something like:

shell "set > testfile.txt"
open "testfile.txt" for input as #1
do while not eof(1)
line input #1, test$
if lcase$(left$(test$,6))="windir" then
testswitch=1
close #1
endif
loop
'that's untested code

or, you could use the environ$ function

kurt mckee
Visit me on the web at: truk (dot) wxs (dot) org

Kurt McKee

no leída,
13 ago 2000, 3:00:0013/8/00
a
hey andreas, do you know of any good books on assembler? I noticed you
seem to understand it, and I was hoping you might know of some way for
me to learn assembler.
TIA,
kurt mckee

On Tue, 8 Aug 2000 23:07:52 +0200, "Andreas Meile" <and...@hofen.ch>
wrote:

>"Kris" <aun...@geneseo.net> schrieb im Newsbeitrag
>news:8mgqql$40qe$1...@news3.infoave.net...

>> Is there a way with QuickBasic to tell if the program is being ran in a
>> Windows DOS box?
>

Visit me on the web at: truk (dot) wxs (dot) org

Andreas Meile

no leída,
13 ago 2000, 3:00:0013/8/00
a
"Kurt McKee" <remove.this.part.AND.th...@juno.com>
schrieb im Newsbeitrag news:3995534b...@news.telepath.com...

> hey andreas, do you know of any good books on assembler? I noticed you
> seem to understand it, and I was hoping you might know of some way for
> me to learn assembler.

During my education at the university, we had a subject called
microcontroller. There we learnt a little Intel 8088/8086 assembly. My big
"PC Bible" at home is a German book called "PC Intern" written by Michael
Tischer. It covers nearly every aspects about system programming.

Today, I don't use assembly directly but in cases when QuickBASIC *lacks* of
a function (see my article
http://dreael.catty.ch/Deutsch/BASIC-Knowhow-Ecke/DOS-Interrupts.html .
There you will also find book references and links.

One of the most valueful links is http://www.ctyme.com/rbrown.htm where you
will find a description of nearly every TSR (=Terminate and Stay Resigent
program as loaded via CONFIG.SYS and AUTOEXEC.BAT) API (=Application
Programming Interface) and Windows/MS-DOS itself. Ralph Brown's homepage
gave me also the hint to DOSISODE so today, I'm able to use my Internet
connection directly from QuickBASIC (see
http://dreael.catty.ch/Deutsch/BASIC-Knowhow-Ecke/InternetMitQuickBASIC.html
), so I could realize a Internet capable online network Rasterbike game (see
http://dreael.catty.ch/Deutsch/Download/Rasterbike.html).

Note that I'm still working on this BASIC knowhow corner, a French and


English translation will follow later, so please use
http://babelfish.altavista.com/translate.dyn at the moment if you don't
speak German.

Andreas

Kurt McKee

no leída,
15 ago 2000, 3:00:0015/8/00
a
thank you

-- kurt mckee

On Sun, 13 Aug 2000 12:39:00 +0200, "Andreas Meile" <and...@hofen.ch>
wrote:

>"Kurt McKee" <remove.this.part.AND.th...@juno.com>

Visit me on the web at: truk (dot) wxs (dot) org

0 mensajes nuevos