Hi, Rajkumar -
I'm not entirely sure I understand what you are asking for, but if you want the path/name of the executing PB application, you can obtain it at runtime via a Windows API function. Here is the external function declaration:
FUNCTION UnsignedLong GetModuleFileNameW ( &
Longptr lhModule, &
REF String sFileName, &
UnsignedLong nSize &
) LIBRARY "kernel32.dll"
Tip: Save after adding the external function declaration, then add the code that calls it, otherwise the compiler will not see/find it.
Here is an example of how the API function can be called:
ULong lul_rc, lul_size
Longptr lp_hmodule
String ls_module_name
// Module handle = 0 means Windows will use the handle of executing module in the current process.
lp_hmodule = 0
// The size of the pre-allocated buffer, in Unicode characters.
lul_size = 300
// To call from PB, PB must pre-allocate the string that will be assigned the executing file path/name.
ls_module_name = Space(lul_size)
lul_rc = GetModuleFileNameW(lp_hmodule,ls_module_name,lul_size)
If lul_rc > 0 Then
// The return code is the length of the string returned by Windows in characters.
MessageBox("Module Name",ls_module_name)
Else
// A return code of zero means API function failed.
MessageBox("Module Name","The path/name of the module cannot be determined.")
End If
When running from within the PB IDE, the path/name of the executing module will be the PB virtual machine (PBnnn.exe). When compiled/deployed, the string returned will contain the path/name where the application's exe is running from.
Best regards, John