홈 · 개발 참고자료

개발 참고자료

[파워빌더] Get the executable name

작성자
관리자
작성일
2016-10-16
조회
10164
분류
파워빌더
[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)

See also this PB HowTo