Application Name


Licensed User
Is it possible to use the coding to retrieve the name of the application?

For example, the application is named as MyApp.exe.

We can write somethings like


and it will prompt up "MyApp.exe" insides the Messagebox.



Active Member
Licensed User
Hi kawawong, welcome b4ppc forum!

Not totally sure what you are after, but 'filesearch' statement may help.
   '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)))

Last edited:
AppName like AppPath?

I searched the forums... w/o satisfied result.

I would need the AppName (MyApp.exe) so that I would be able to open then the settings file (MyApp.ini) and the default text file (MyApp.txt).

Knowing all .exe inside AppPath folder... isn't a real help, since there can and will be more .exe files.

To some of you knowing .NET... could I find something there?

Thank you for ANY help/answer.

Best regards,
Ionut Ojica
Last edited:


Licensed User
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.
Last edited:

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
Could I ask how? Thanks in advance.

P/Invoke to native code
I have searched and found informations about this here:
An Introduction to P/Invoke and Marshaling on the Microsoft .NET Compact Framework

To find the solution would take me around a week... for the moment I choose the first way.

Best regards,
Ionut Ojica
Thank you for the fast answer.

Oh, so none of them work on Device... but on Desktop they give the right path with file name.
Sub App_Start
End Sub

Sub Method1
 obj.CreateNew("System.Reflection.Assembly" & obj.System_Mscorlib)
 obj.Value = obj.RunMethod("GetEntryAssembly")
 label1.Text = obj.GetProperty("Location")
End Sub
Sub Method2
 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
 obj.CreateNew("System.Windows.Forms.Application" & obj.System_Windows_Forms)
 label1.Text = obj.GetProperty("ExecutablePath")
End Sub
Last edited: