Application Name

Discussion in 'Questions (Windows Mobile)' started by kawawong, Feb 12, 2008.

  1. kawawong

    kawawong Member 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.

  2. Rioven

    Rioven 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: Feb 12, 2008
  3. ionutojica

    ionutojica Banned

    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: May 8, 2012
  4. Jost aus Soest

    Jost aus Soest Active Member Licensed User

    What's about Activity.Title?
  5. agraham

    agraham Expert 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: May 8, 2012
  6. ionutojica

    ionutojica Banned


    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.

    Could I ask how? Thanks in advance.

    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
  7. agraham

    agraham Expert Licensed User



  8. ionutojica

    ionutojica Banned

    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(
     label1.Text = obj.GetProperty(
    End Sub
    Sub Method2
     oProcess.CreateNew("System.Diagnostics.Process" & oProcess.System_NS)
     oProcess.Value = oProcess.RunMethod(
    "System.Diagnostics.ProcessModule" & oProcess.System_NS)
     obj.Value = oProcess.GetProperty(
     label1.Text = obj.GetProperty(
    End Sub
    Sub Method3
     obj.CreateNew("System.Windows.Forms.Application" & obj.System_Windows_Forms)
     label1.Text = obj.GetProperty(
    End Sub
    Last edited: May 18, 2012
  9. agraham

    agraham Expert Licensed User

    That's what I said before.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice