Not totally sure what you are after, but 'filesearch' statement may help.
Example:
B4X:
'first create control arraylist al1 on the form.
FileSearch(al1,AppPath,"*.exe") 'gather all exe files from application directory and assign file list to arraylist 'al1'.
'you can display each file names excluding file path something like:
For i = 0 To al1.count-1
Msgbox(SubString (al1.item(i), StrLength(AppPath)+1,StrLength(al1.item(i))+1-StrLength(AppPath)))
Next
Wrong forum - this is about Windows Mobile, hence the reference to an exe file..
Unfortunately there is no way I can think of, even using reflection, to obtain the actual filename as all compiled Basic4ppc assemblies (exe) have the actual assembly name of "1" (which can be obtained by the Door library but is not of much use) and are renamed after compilation to match the project name. It is easy to get the actual filename on the desktop but the Compact Framework lacks that ability and a P/Invoke to native code is the only way I have found so far that will work on a device.
The simplest workaround I suppose would be to pass the file name as an argument to the program.
And so, in a folder could be many files with their shortcuts, inside the shortcuts would be the link to the file and the file name as an argument.
Not the right way... but it works for sure.
It is easy to get the actual filename on the desktop
Oh, so none of them work on Device... but on Desktop they give the right path with file name.
B4X:
Sub App_Start
Form1.Show
obj.New1(False)
oProcess.New1(False)
Method3
End Sub
Sub Method1
'System.Reflection.Assembly.GetEntryAssembly().Location
obj.CreateNew("System.Reflection.Assembly" & obj.System_Mscorlib)
obj.Value = obj.RunMethod("GetEntryAssembly")
label1.Text = obj.GetProperty("Location")
End Sub
Sub Method2
'System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName:
oProcess.CreateNew("System.Diagnostics.Process" & oProcess.System_NS)
oProcess.Value = oProcess.RunMethod("GetCurrentProcess")
obj.CreateNew("System.Diagnostics.ProcessModule" & oProcess.System_NS)
obj.Value = oProcess.GetProperty("MainModule")
label1.Text = obj.GetProperty("FileName")
End Sub
Sub Method3
'System.Windows.Forms.Application.ExecutablePath
obj.CreateNew("System.Windows.Forms.Application" & obj.System_Windows_Forms)
label1.Text = obj.GetProperty("ExecutablePath")
End Sub