Category : BASIC Source Code
Archive   : QBFAQR01.ZIP
Filename : NETID.BAS

 
Output of file : NETID.BAS contained in archive : QBFAQR01.ZIP
'Date: 05-22-92 (12:20)
'From: TONY ELLIOTT
'-------------------------------------------------------------------------
'MK>Does anybody have a routine to check either the network node ID or the
'MK>card id on a NetBios based network, such as LanTastic?

'Here's a little routine you can use to return the machine name and ID
'on NetBios compatible networks. It'll return a null string if a
'compatible network is not running. Hope it helps.

'-------------------
DEFINT A-Z

DECLARE FUNCTION MachineName$ (MachineNumber%)
REM $INCLUDE: 'QBX.BI' 'Use QB.BI for QB4.x

ThisMachine$ = MachineName$(MachineNumber%)
IF LEN(ThisMachine$) THEN
PRINT "Machine Name: "; ThisMachine$
PRINT " Machine #:"; MachineNumber%
ELSE
PRINT "NetBIOS compatible network not installed."
END IF

FUNCTION MachineName$ (MachineNumber%)

'If a NetBIOS compatible network is installed, this function returns
'the machine name as a result of the function and the machine's NetBIOS
'ID number in the MachineNumber% parameter.

'If a network is not detected, the function returns a null string.

DIM Reg AS RegTypeX 'In QB.BI (or QBX.BI if using PDS)
DIM Temp AS STRING * 16 'Buffer to hold machine name
MachineNumber% = 0 'Make sure it is zero
Reg.ax = 0 'Use function 0 of interrupt 2ah
CALL InterruptX(&H2A, Reg, Reg)
IF Reg.ax AND &HFF00 THEN 'If AH <> 0 then network was found
Reg.ax = &H5E00
Reg.ds = VARSEG(Temp)
Reg.dx = VARPTR(Temp)
CALL InterruptX(&H21, Reg, Reg)
IF Reg.flags AND 1 THEN 'Did an error occur?
EXIT FUNCTION
END IF
MachineNumber% = Reg.cx AND &HFF 'Machine # in CL
MachineName$ = RTRIM$(Temp)
END IF

END FUNCTION

'-------------


  3 Responses to “Category : BASIC Source Code
Archive   : QBFAQR01.ZIP
Filename : NETID.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/