|
Post by James Grubbs (Jimmy) on Apr 4, 2019 22:34:30 GMT -5
Does anyone know how to make a .exe recognize it's own file name while running without hard coding the file name. The name of this .exe file will change continually and I won't know what it is changed to but the program needs to know. writing a second file is out of the question. Thank you for any help on this.
|
|
|
Post by Chris Iverson on Apr 4, 2019 22:49:15 GMT -5
Here's a function that'll do it.
Note that it gives the entire path, not just the EXE name.
print GetEXEName$()
Function GetEXEName$() exename$ = space$(_MAX_PATH)
CallDLL #kernel32, "GetModuleFileNameA",_ _NULL as ulong,_ exename$ as ptr,_ _MAX_PATH as long,_ ret as long
GetEXEName$ = trim$(exename$) End Function
|
|
|
Post by James Grubbs (Jimmy) on Apr 4, 2019 23:06:26 GMT -5
Chris, You sir are the bomb! Thank you very much. Works perfect. I need to learn more about DLL's. I bought Alyce's API's for Liberty Basic. I read it. I now need to study it. Thanks again Chris.
|
|