BBS: Inland Empire Archive Date: 12-09-92 (13:10) Number: 375 From: JOE NEGRON Refer#: NONE To: FRED MCDONALD Recvd: NO Subj: Re: qbas or exe Conf: (2) Quik_Bas
FM> Hmmmmmm, Yes, you are right. Errrrrrr, Just one thing, How do FM> I get the program to check the extention of the program that is being FM> run? I know that there is an program action to get the Path/Name of FM> the current program running, but this would show an EXE whether the FM> program running is a This should do it: ============================== Begin code ============================== DEFINT A-Z '$INCLUDE: 'qbx.bi' DECLARE FUNCTION ProgramName$ () PRINT RIGHT$(ProgramName$, 3) SYSTEM '*********************************************************************** '* FUNCTION ProgramName$ '* '* PURPOSE '* Uses DOS ISR 21H, Function 62H (Get PSP Address) to return the '* name of the currently executing program. '* '* EXTERNAL ROUTINE(S) '* QBX.LIB '* ------- '* SUB Interrupt (IntNum%, IRegs AS RegType, ORegs AS RegType) '*********************************************************************** FUNCTION ProgramName$ STATIC DIM IRegs AS RegType, ORegs AS RegType IRegs.ax = &H5100 Interrupt &H21, IRegs, ORegs DEF SEG = ORegs.bx EnvSeg% = PEEK(&H2C) + PEEK(&H2D) * 256 DEF SEG = EnvSeg% DO Value% = PEEK(Offset%) IF Value% = 0 THEN Count% = Count% + 1 IF Count% AND ExeFlag% THEN EXIT DO ELSEIF Count% = 2 THEN ExeFlag% = -1 Offset% = Offset% + 2 END IF ELSE Count% = 0 IF ExeFlag% THEN Temp$ = Temp$ + CHR$(Value%) END IF END IF Offset% = Offset% + 1 LOOP DEF SEG ProgramName$ = Temp$ Temp$ = "" END FUNCTION =============================== End code =============================== If you run this in the IDE (QB/QBX), it will return the name of the IDE (QB.EXE or QBX.EXE). Also, if you are using QB, change the $INCLUDE metacommand to read "'$INCLUDE: 'qb.bi'". --Joe in Bay Ridge, Brooklyn, NY-- Wed 12-09-1992, 12:58 * SLMR 2.1a * Microsoft Virus: UNRECOVERABLE APPLICATION ERROR! --- Maximus 2.01wb * Origin: * BlueDog BBS * (212) 594-4425 * NYC FileBone Hub (1:278/709)
Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET