Guest_imported
New member
- Jan 1, 1970
- 0
Hello...
I was "exploring" and did a dump like so..
====
OPEN "_DUMP" FOR OUTPUT AS 1
DEF SEG = 0
FOR p& = 0 TO 65535
PRINT #1, CHR$(PEEK(p&));
NEXT
CLOSE 1
====
Then I examined the _DUMP file and noticed that starting at byte 32620, it always gave the current running program name with path. Then I put together this little function. I don't know if this just works for my computer or what, but it seems to work ok. When run under the IDE, it says QB.EXE is running, and when compiled, it gives the compiled filename. Strange though, if I run it SHELL'ed from another prog, it gives the first prog, and not itself.
Could some who knows what is going on here (I don't you can see) maybe explain it a little for me.
'================================
'Shows currently running program.
'Gives program name and full path
DEFINT A-Z
DECLARE FUNCTION CurProg$ ()
PRINT "Program running: "; CurProg$
FUNCTION CurProg$
TEMP$ = ""
DEF SEG = 0
'build filename...
FOR c% = 0 TO 256
A% = PEEK(34619 + c%)
'stop if null found
IF A% = 0 THEN EXIT FOR
TEMP$ = TEMP$ + CHR$(A%)
NEXT
DEF SEG
CurProg$ = TEMP$
END FUNCTION
'=================================