Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exploring memory....

Status
Not open for further replies.

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
'=================================


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top