473,398 Members | 2,393 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,398 software developers and data experts.

application name

how to get the name of a running application using C#

e.g. if i have 20 dll files and my application name is MyGreatApplication
then how to get the name "MyGreatApplication" at runtime?

thx in adv.
c
Nov 16 '05 #1
2 13109
Chang

Have a look at the Application.ProductName attribute. Something like this:

/* ******************************* */
static void Main()
{
string appName = Application.ProductName;
Application.Run(new MyFirstForm());
}
/* ******************************* */

regards
roy fine
"Chang" <po******@hotmail.com> wrote in message
news:OF****************@TK2MSFTNGP09.phx.gbl...
how to get the name of a running application using C#

e.g. if i have 20 dll files and my application name is MyGreatApplication
then how to get the name "MyGreatApplication" at runtime?

thx in adv.
c

Nov 16 '05 #2
The ProductName is linked to several different code-paths including attributes
and/or the type
that contains the entry point for the executable. Because you can change the
name through the
resources, you may or may not want to simply use the entry point type.

Assembly main = Assembly.GetEntryAssembly();
if ( main != null ) { return main.EntryPoint.ReflectedType; }

That'll give you the type hosting the entry point and should be very stable.
Unless you often
change class names.

--
Justin Rogers
DigiTec Web Consultants, LLC.
Blog: http://weblogs.asp.net/justin_rogers

"Roy Fine" <rl****@twt.obfuscate.net> wrote in message
news:uw**************@TK2MSFTNGP09.phx.gbl...
Chang

Have a look at the Application.ProductName attribute. Something like this:

/* ******************************* */
static void Main()
{
string appName = Application.ProductName;
Application.Run(new MyFirstForm());
}
/* ******************************* */

regards
roy fine
"Chang" <po******@hotmail.com> wrote in message
news:OF****************@TK2MSFTNGP09.phx.gbl...
how to get the name of a running application using C#

e.g. if i have 20 dll files and my application name is MyGreatApplication
then how to get the name "MyGreatApplication" at runtime?

thx in adv.
c


Nov 16 '05 #3

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

Similar topics

1
by: Dennis | last post by:
Hi, I am wondering that the Application Name in Virtual Directory is compulsory be non-empty field when configuring Virtual Directory for ASP.NET application? I realized some of my ASP.NET...
10
by: florian | last post by:
Hi, we have a contention problem because of an application which tries to insert a duplicate row in a table with primary key. This insert fails of course but the locks are not released within...
4
by: Chuck | last post by:
Hello everybody, I need to abort execution during start up, while the constructor called by Application.Run is executing. If the database fails to connect during my application's startup I...
6
by: Ollie Riches | last post by:
I understand the use of Application.DoEvents() to process all outstanding messages on the message queue in a winforms application if you have long running process on the UI thread. But can anyone...
13
by: Bob Day | last post by:
Using vs2003, vb.net I start a thread, giving it a name before start. Code snippet: 'give each thread a unique name (for later identification) Trunk_Thread.Name = "Trunk_0_Thread" ' allow...
6
by: JeffDotNet | last post by:
Writing to a registered source in the Application event log I have an asp.net framework 2.0 app that I created on a winxp machine and now I am deploying it to IIS6 on a win server2003 machine. ...
12
by: Martyn Fewtrell | last post by:
Hi there I'm trying to find the correct way to write exceptions to the Application log using Vb.Net. I've done a fair bit of Googleing and although this gets plenty of mentions and that this...
2
by: Learning.Net | last post by:
hi , I have a application which reads files, directory,and its version and version information is written to text file.Its working fine if files in directory are less but problem arises when no...
3
by: John | last post by:
Hi Is there an easy way to allow user to change application settings at run time short of editing the configuration file manually? Thanks Regards
0
by: Steve | last post by:
Hello- Your assistance with this issue is greatly appreciated. Environment: - Load-balanced IIS 6.0 servers (Win2003) - web servers point (via UNC path) to a Microsoft File Cluster on...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.