473,382 Members | 1,745 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Getting the name of my application at runtime...


Hello,

Is there a way to get the name of my application (as it appears on the
list of processes running) at runtime?

(Something to do with System.Reflection...?)

Thanks,

Gary
Mar 13 '06 #1
6 3132

beaker wrote:
Hello,

Is there a way to get the name of my application (as it appears on the
list of processes running) at runtime?


Application.ProductName

--
Larry Lard
Replies to group please

Mar 13 '06 #2
Larry Lard wrote:
beaker wrote:
Hello,

Is there a way to get the name of my application (as it appears on the
list of processes running) at runtime?

Application.ProductName


Thanks for the reply, but I believe that only gives me the assembly name
(as filled in in my AssemblyInfo.cs), and not the name of the .exe -
which aren't neccessarily the same (I tried renaming my app to check).

Gary
Mar 13 '06 #3
beaker,

Task manager's Application tab shows the caption of the application's
top-level windows.
The process tab on the other hand shows the name of the executables. As long
as there are couple of ways you can get that I think the easises is to
extract the file name from
Application.ExecutablePath. To extract the file name only you can use the
Path.GetFileName.

I don't know about Application.ProductName. I personally have never used it,
but if you say that this is not what you want then try using
Application.ExecutablePath.

If you want to get reference to the executable file assembly you can use
Assembly.GetEntryAssembly static method.
--
HTH
Stoitcho Goutsev (100)

"beaker" <ra*********@notrealcompanyIhope.com> wrote in message
news:u4****************@TK2MSFTNGP14.phx.gbl...
Larry Lard wrote:
beaker wrote:
Hello,

Is there a way to get the name of my application (as it appears on the
list of processes running) at runtime?

Application.ProductName


Thanks for the reply, but I believe that only gives me the assembly name
(as filled in in my AssemblyInfo.cs), and not the name of the .exe - which
aren't neccessarily the same (I tried renaming my app to check).

Gary

Mar 13 '06 #4
Hi,

Process.GetCurrentProcess().ProcessName ?
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"beaker" <ra*********@notrealcompanyIhope.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...

Hello,

Is there a way to get the name of my application (as it appears on the
list of processes running) at runtime?

(Something to do with System.Reflection...?)

Thanks,

Gary

Mar 13 '06 #5
beaker wrote:

Hello,

Is there a way to get the name of my application (as it appears on the
list of processes running) at runtime?

(Something to do with System.Reflection...?)

Thanks,

Gary


Thanks,

Process.GetCurrentProcess().ProcessName

and

Path.GetFileNameWithoutExtension(Application.Execu tablePath)

both worked fine.

I was working on a way of stopping multiple instances of my program
running, so wanted to check my app against a list of running process
(allowing for the .exe having been renamed from the original).
Of course, this all falls down if different copies of my program exist
with different names, but I can live with that for the moment.

Cheers,

Gary
Mar 14 '06 #6
Hi,

If you ask the correct question frmo the beggining you get the correct
answer from the beginning :)

http://www.yoda.arachsys.com/csharp/...ation.instance


"beaker" <ra*********@notrealcompanyIhope.com> wrote in message
news:eb**************@TK2MSFTNGP14.phx.gbl...
beaker wrote:

Hello,

Is there a way to get the name of my application (as it appears on the
list of processes running) at runtime?

(Something to do with System.Reflection...?)

Thanks,

Gary


Thanks,

Process.GetCurrentProcess().ProcessName

and

Path.GetFileNameWithoutExtension(Application.Execu tablePath)

both worked fine.

I was working on a way of stopping multiple instances of my program
running, so wanted to check my app against a list of running process
(allowing for the .exe having been renamed from the original).
Of course, this all falls down if different copies of my program exist
with different names, but I can live with that for the moment.

Cheers,

Gary

Mar 14 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Pat | last post by:
In my Web.config i have :- <customErrors mode="On" defaultRedirect="genericerror.htm"> <error statusCode="404" redirect="pagenotfound.aspx"/> </customErrors to get page not found error but...
3
by: | last post by:
I wrote a class in VB.NET to export the contents of a datagrid to Excel. It works perfectly on my machine, but it fails on my customers' PCs that have identical versions of Win XP (SP1) and Excel...
1
by: Brian Henry | last post by:
I need to mark assemblies with a unique id (GUID in this case) and retrieve it when the assembly is loaded into my application (a plug-in loader)... the plug-in assembly all have a class in it...
1
by: kplkumar | last post by:
I am trying to get the method and the parameters passed to that method from the stackTrace. My code is, private void GetExecutingMethodInfo() { StackTrace trace = new StackTrace(false); ...
2
by: MSK | last post by:
Hi, Continued to my earlier post regaring "Breakpoints are not getting hit" , I have comeup with more input this time.. Kindly give me some idea. I am a newbie to .NET, recently I installed...
5
by: SunnyDrake | last post by:
HI! I wrting some program part of it is XML config parser which contains some commands(for flexibility of engenie). how do i more simple(if it possible not via System.Reflection or...
7
by: =?Utf-8?B?UVNJRGV2ZWxvcGVy?= | last post by:
I have a C# logging assembly with a static constructor and methods that is called from another C# Assembly that is used as a COM interface for a VB6 Application. Ideally I need to build a file...
4
by: Raymon Du | last post by:
Hi, I am getting the following exception every time I modified web.config, the only way to fix it is to recycle application pool or restart IIS, but I don't want to do that all the times. TIA
15
denny1824
by: denny1824 | last post by:
I have a working website. I copied all the files to a new folder in inetpub/wwwroot and then set that folder as a Virtual Directory in IIS. I try going to that site from the new folder and i am...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.