Hello,
From within the executing HMG application how can I programmatically determine the base program name?
For instance if my program is called myapp.exe I'd like it to return myapp.
Thanks,
Michael
Get App Name
Moderator: Rathinagiri
- esgici
- Posts: 4543
- Joined: Wed Jul 30, 2008 9:17 pm
- DBs Used: DBF
- Location: iskenderun / Turkiye
- Contact:
Re: Get App Name
Hello Michael
GetProgramFileName() => <cProgramFileNameWithFullPath>
For only file name you can use :
TOKEN( GetProgramFileName(),"\" )
Regards
--
Esgici
GetProgramFileName() => <cProgramFileNameWithFullPath>
For only file name you can use :
TOKEN( GetProgramFileName(),"\" )
Regards
--
Esgici
Viva INTERNATIONAL HMG
-
- Posts: 119
- Joined: Wed Feb 18, 2009 2:14 pm
Re: Get App Name
esgici,
Great - thanks!
I wrapped it in a function.
Michael
#include "minigui.ch"
Function Main
msginfo( getAppBaseName() )
return
function getAppBaseName()
local cGetProgramFileName, nPosOfDot, cAppName
cGetProgramFileName := TOKEN( GetProgramFileName(),"\" )
nPosOfDot := at('.', cGetProgramFileName)
cAppName := SubStr( cGetProgramFileName, 1, nPosOfDot -1 )
return cAppName
Great - thanks!
I wrapped it in a function.
Michael
#include "minigui.ch"
Function Main
msginfo( getAppBaseName() )
return
function getAppBaseName()
local cGetProgramFileName, nPosOfDot, cAppName
cGetProgramFileName := TOKEN( GetProgramFileName(),"\" )
nPosOfDot := at('.', cGetProgramFileName)
cAppName := SubStr( cGetProgramFileName, 1, nPosOfDot -1 )
return cAppName
- Rathinagiri
- Posts: 5471
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: Get App Name
Instead of at, if you put rat it will be ok. Isn't it?!
If the application's name is x.y.z.exe then x will the string that will be returned.
If the application's name is x.y.z.exe then x will the string that will be returned.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
- esgici
- Posts: 4543
- Joined: Wed Jul 30, 2008 9:17 pm
- DBs Used: DBF
- Location: iskenderun / Turkiye
- Contact:
Re: Get App Name
Hi Michael
Good.
Or in a more short and lazy ( ) way :
Regards
--
Esgici
Good.
Or in a more short and lazy ( ) way :
Code: Select all
#include "minigui.ch"
Function Main
msginfo( TOKEN( TOKEN( GetProgramFileName(), "." , 1 ), "\" ) )
return
--
Esgici
Viva INTERNATIONAL HMG
-
- Posts: 119
- Joined: Wed Feb 18, 2009 2:14 pm
Re: Get App Name
Guys,
Thanks. Good suggestions!
Michael
Thanks. Good suggestions!
Michael