Board index » delphi » Detecting Windows from non-Windows program

Detecting Windows from non-Windows program

Is there any way for a DOS-based program to detect whether it is running under
Windows or Windows 95?

 

Re:Detecting Windows from non-Windows program


On 18 Jan 1997 01:15:44 GMT, jes...@inq.fi (The Bishop) wrote:

Quote
>Is there any way for a DOS-based program to detect whether it is running under
>Windows or Windows 95?

This is what I use (bp7.0 real-mode):

FUNCTION TaskMultiplexerActive:BOOLEAN;
{detect whether this program is running under windows!}
VAR Regs   :TREGISTERS;
    ExtMode:BYTE;
BEGIN
{start optimistic}
  TaskMultiplexerActive := FALSE;
{call multiplexer using assembler because borland won't cooparate here!}
  ASM
    MOV AX, $1600
    INT $2F
    MOV ExtMode, AL
  END;
{branch on result}
  CASE ExtMode OF
    $00,
    $80: WITH Regs DO
         BEGIN
           AX := $4680;
           intr($2F,Regs);
           IF AL = $80 THEN EXIT; {it was not active}
           TaskMultiplexerActive := TRUE;
         END;
    ELSE TaskMultiplexerActive := TRUE;
  END;
END; {TaskMultiplexerActive}

It doesn't actually detect windows but in practice it works fine.

Peter de Jong
wpdej...@worldonline.nl

Other Threads