Windows Vista Forums

Can a prog find its own Name?

  1. #1


    Barry Flynn Guest

    Can a prog find its own Name?

    Win Forms program - VB 2005.

    I am converting a VB6 program to VB 2005.
    The program wants to know its own name - ie the name of the .exe that has
    been executed.
    It gets this from App.exename



    In VB 2005, I have replaced this with My.Application.Info.AssemblyName.
    However, if the program has been renamed after it was Built, that returns
    the name it was Built as, rather than the name of the .exe that has actually
    been executed.

    Is the name of the actual .exe available?

    Thanks

    Barry



      My System SpecsSystem Spec

  2. #2


    Scott M. Guest

    Re: Can a prog find its own Name?


    "Barry Flynn" <Anonymouse> wrote in message
    news:%23Fr3HL8ZKHA.4932@newsgroup

    > Win Forms program - VB 2005.
    >
    > I am converting a VB6 program to VB 2005.
    > The program wants to know its own name - ie the name of the .exe that has
    > been executed.
    > It gets this from App.exename
    >
    > In VB 2005, I have replaced this with My.Application.Info.AssemblyName.
    > However, if the program has been renamed after it was Built, that returns
    > the name it was Built as, rather than the name of the .exe that has
    > actually been executed.
    >
    > Is the name of the actual .exe available?
    >
    > Thanks
    >
    > Barry
    Will this work?

    [C#]
    System.Diagnostics.Process p =
    System.Diagnostics.Process.GetCurrentProcess();
    String n = p.ProcessName;

    -Scott



      My System SpecsSystem Spec

  3. #3


    Barry Flynn Guest

    Re: Can a prog find its own Name?

    Looks good.

    Thanks

    Barry


    "Scott M." <s-mar@newsgroup> wrote in message
    news:%23FKwut9ZKHA.2160@newsgroup

    >
    > "Barry Flynn" <Anonymouse> wrote in message
    > news:%23Fr3HL8ZKHA.4932@newsgroup

    >> Win Forms program - VB 2005.
    >>
    >> I am converting a VB6 program to VB 2005.
    >> The program wants to know its own name - ie the name of the .exe that has
    >> been executed.
    >> It gets this from App.exename
    >>
    >> In VB 2005, I have replaced this with My.Application.Info.AssemblyName.
    >> However, if the program has been renamed after it was Built, that returns
    >> the name it was Built as, rather than the name of the .exe that has
    >> actually been executed.
    >>
    >> Is the name of the actual .exe available?
    >>
    >> Thanks
    >>
    >> Barry
    >
    > Will this work?
    >
    > [C#]
    > System.Diagnostics.Process p =
    > System.Diagnostics.Process.GetCurrentProcess();
    > String n = p.ProcessName;
    >
    > -Scott
    >
    >


      My System SpecsSystem Spec

Can a prog find its own Name?

Similar Threads
Thread Thread Starter Forum Replies Last Post
On prog uninstall some elements remaining grasmith General Discussion 6 25 Mar 2010
Delete Windows Live Messenger as Prog or S hadov Live Messenger 0 07 Oct 2009
Outlook 2007 Backup Prog Removal ianb Vista mail 1 12 Sep 2009
Blocked Startup Prog. Icon/Win. Defender Bare Foot Kid General Discussion 0 17 Feb 2008
Windows Mail prog sirwilliam Vista installation & setup 3 01 Sep 2007