[local external function declaration]
FUNCTION ulong GetModuleFileName (ulong hinstModule, ref string lpszPath, ulong cchPath ) &
LIBRARY "KERNEL32.DLL" &
ALIAS FOR "GetModuleFileNameA;ansi" // ;ansi required for PB10 or better
[powerscript]
ClassDefinition lcd
String ls_fullpath
ulong lul_handle, lul_length = 512
IF handle(getapplication()) = 0 THEN
// running from the IDE
lcd=getapplication().classdefinition
ls_fullpath = lcd.libraryname
ELSE
// running from EXE
lul_handle = handle( getapplication() )
ls_fullpath=space(lul_length)
GetModuleFilename( lul_handle, ls_fullpath, lul_length )
END IF
MessageBox("", ls_fullpath)
Tuesday, January 15, 2013
Get the executable name
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment