CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2005
    Posts
    23

    Question Detecting the name of an application?

    How would you code a VB.net application to detect it's own name, even after the end-user has renamed it?

    For example, say you write a quick program whose name is Cheez-It.exe, which when you open, simply displays its name (Cheez-It.exe) in a label. If it were then renamed Pop-Tart.exe, and re-opened, the name Pop-Tart.exe would appear in the label instead. Is there a way to code this?

  2. #2
    Join Date
    Jun 2001
    Location
    MO, USA
    Posts
    2,868

    Re: Detecting the name of an application?

    Try Application.ProductName

  3. #3
    Join Date
    Jan 2005
    Posts
    70

    Re: Detecting the name of an application?

    System.Diagnostics.Process.GetCurrentProcess.ProcessName

  4. #4
    Join Date
    Feb 2005
    Posts
    23

    Lightbulb Re: Detecting the name of an application?

    Quote Originally Posted by SatyaV
    System.Diagnostics.Process.GetCurrentProcess.ProcessName
    Well I feel awefully stupid for missing that, seeing as my application involves managing processes! I'll try it and see. Thanks!

  5. #5
    Join Date
    Feb 2005
    Posts
    23

    Re: Detecting the name of an application?

    Well that was close... It is actually:

    System.Diagnostics.Process.GetCurrentProcess.ToString

    which formats the name of the process as a string. But you got me on the right track!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured