PC Review


Reply
Thread Tools Rate Thread

Can a prog find its own Name?

 
 
Barry Flynn
Guest
Posts: n/a
 
      17th Nov 2009
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


 
Reply With Quote
 
 
 
 
Scott M.
Guest
Posts: n/a
 
      17th Nov 2009

"Barry Flynn" <Anonymouse> wrote in message
news:%(E-Mail Removed)...
> 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


 
Reply With Quote
 
Barry Flynn
Guest
Posts: n/a
 
      18th Nov 2009
Looks good.

Thanks

Barry


"Scott M." <s-(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>
> "Barry Flynn" <Anonymouse> wrote in message
> news:%(E-Mail Removed)...
>> 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
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Which prog where I can find things like Home inventory ??? =?Utf-8?B?Q2FybCBNaWNoYWVsIEpld2l0dA==?= Microsoft Access 1 6th May 2006 11:30 AM
Can't find OE prog. after switching to Outlook =?Utf-8?B?QmFyYkJDMw==?= Microsoft Outlook Discussion 6 7th Mar 2006 06:39 PM
Why does an instant messaging prog start when my email prog starts =?Utf-8?B?VGhhdCBndXk=?= Microsoft Outlook Discussion 1 31st Jul 2005 09:04 AM
How to find prog using disk? Brett Windows XP General 8 27th Apr 2005 10:40 PM
Security Centre can't find anti-virus prog Stephen Glynn Windows XP Help 1 18th Feb 2005 05:54 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:35 AM.