473,804 Members | 3,674 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Reflecti on...?)

Thanks,

Gary
Mar 13 '06 #1
6 3151

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.Pro ductName

--
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.Pro ductName


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.Exe cutablePath. To extract the file name only you can use the
Path.GetFileNam e.

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

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

"beaker" <ra*********@no trealcompanyIho pe.com> wrote in message
news:u4******** ********@TK2MSF TNGP14.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.Pro ductName


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.GetCurr entProcess().Pr ocessName ?
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"beaker" <ra*********@no trealcompanyIho pe.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.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.Reflecti on...?)

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.Reflecti on...?)

Thanks,

Gary


Thanks,

Process.GetCurr entProcess().Pr ocessName

and

Path.GetFileNam eWithoutExtensi on(Application. ExecutablePath)

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*********@no trealcompanyIho pe.com> wrote in message
news:eb******** ******@TK2MSFTN GP14.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.Reflecti on...?)

Thanks,

Gary


Thanks,

Process.GetCurr entProcess().Pr ocessName

and

Path.GetFileNam eWithoutExtensi on(Application. ExecutablePath)

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
13625
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 instead i keep getting a RUN TIME error below: Any ideas.. Runtime Error
3
9929
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 (SP1) installed. The error is: System.Runtime.InteropServices.COMException(0x800A03EC): Exception from HRESULT: 0x800A03EC. at Microsoft.Office.Interop.Excel._Worksheet.Paste(Object Destination, Object Link) at...
1
5459
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 which implements our plug-in base class (which really is a default implementation of a interface IPlugin we created) The plug-in class looks like this Imports bdb
1
4124
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); for (int index = 0; index < trace.FrameCount; ++index)
2
4225
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 .NET. I could not debug using breakpoints, breakpoints are not getting hit, but the application is working fine with out any issue.
5
2312
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 System.CodeDom.CodeCastExpression) __problem typecast #1 Desc:i do needed checks but data/commands in XML is dynamic and i don't wanna fix C# code again and again... Sample:foreach (object some in somearray) (some.GetType())some.someaction();
7
2691
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 name based on the name of the VB6 application. A second choice would be a file name based on the # COM interface assembly. I have tried calling Assembly.GetCallingAssembly() but this fails when I use the VB6 client. Is there a way to get this...
4
1156
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
7908
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 getting a default error page. It is an aspx page that I am trying to view. If I put in a fake page name it gives a different error about that fake name not existing, which means to me that it is seeing the page I want to view but is giving an error...
0
9704
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10562
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10319
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10070
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7608
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6845
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5639
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3803
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2978
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.