Category : Files from Magazines
Archive   : V12N09.ZIP
Filename : WINFUN.BAS

 
Output of file : WINFUN.BAS contained in archive : V12N09.ZIP
'********** WINSTUFF.BAS - Harry F. Harrison

DEFINT A-Z
'$INCLUDE: 'QB.BI' 'use QBX.BI with PDS, or VBDOS.BI with VB/DOS

DECLARE FUNCTION WindowsActive% (Ver!)
DECLARE FUNCTION GetCurrentWindowsVM% ()

SELECT CASE WindowsActive%(Ver!)
CASE 0: PRINT "Neither Windows nor DOS Shell are active"
CASE -1: PRINT "Windows 386 Enhanced mode is active, ";
PRINT USING "Version #.##"; Ver!
CASE 1: PRINT "DOS Shell is active"
CASE 2: PRINT "Windows Standard Mode is active"
END SELECT

PRINT "Windows Virtual Machine ID #:"; GetCurrentWindowsVM%

'END OF DEMO

SUB EndCriticalCode

'Reenables Windows swapping after a call to StartCriticalCode.
DIM InRegsX AS RegTypeX, OutRegsX AS RegTypeX
InRegsX.AX = &H1682
CALL InterruptX(&H2F, InRegsX, OutRegsX)

END SUB

FUNCTION GetCurrentWindowsVM%

'Gets the current Virtual Machine ID under Windows.
DIM InRegsX AS RegTypeX, OutRegsX AS RegTypeX
InRegsX.AX = &H1683
CALL InterruptX(&H2F, InRegsX, OutRegsX)
GetCurrentWindowsVM% = OutRegsX.bx

END FUNCTION

SUB GiveUpTimeSlice

'Gives up the remainder of a time slice to Windows.
DIM InRegsX AS RegTypeX, OutRegsX AS RegTypeX
InRegsX.AX = &H1680
CALL InterruptX(&H2F, InRegsX, OutRegsX)

END SUB

SUB StartCriticalCode

'Prevents Windows from swapping out.
DIM InRegsX AS RegTypeX, OutRegsX AS RegTypeX
InRegsX.AX = &H1681
CALL InterruptX(&H2F, InRegsX, OutRegsX)

END SUB

FUNCTION WindowsActive% (Ver!)

'determines whether Windows is Active and if so which version.

DIM InRegsX AS RegTypeX, OutRegsX AS RegTypeX
InRegsX.AX = &H1600
CALL InterruptX(&H2F, InRegsX, OutRegsX)

IF (OutRegsX.AX AND &HFF <> 0) AND (OutRegsX.AX AND &HFF <> &H80) AND (OutRegsX.AX <> &H1600) THEN
WindowsActive% = -1
Ver! = (((OutRegsX.AX AND &HFF) * 100) + OutRegsX.AX \ 256) / 100
ELSE
InRegsX.bx = 0
InRegsX.di = 0
InRegsX.es = 0
InRegsX.AX = &H4B02
CALL InterruptX(&H2F, InRegsX, OutRegsX)
IF OutRegsX.es OR OutRegsX.di THEN
WindowsActive% = 1
END IF
IF LEN(ENVIRON$("windir")) THEN
WindowsActive% = 2
END IF
END IF

END FUNCTION



  3 Responses to “Category : Files from Magazines
Archive   : V12N09.ZIP
Filename : WINFUN.BAS

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/