473,511 Members | 16,846 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Detect if app was started from VS

bz
Hi,

I need to detect at runtime if the application was started from VS
2005. Is it possible?
Also, how can I know at runtime of app is built for Debug or Release?

Thanks
Nov 17 '07 #1
2 1788
You can tell Visual Studio to run your application with a special command
line argument. Click Project -Properties -Debug and enter "/debug" as an
argument. Use the following if-statement in your program to detect if it was
started from Visual Studio:

string[] args = Environment.GetCommandLineArgs(); // remove this line if
your program is a console application
if (args.Length 0 && args[0] == "/debug")
// started from VS
else
// not started from VS

I'm sure there are more elegant solutions but this is one of the easiest.

"bz" <bz*****@gmail.comschrieb im Newsbeitrag
news:fc**********************************@e1g2000h sh.googlegroups.com...
Hi,

I need to detect at runtime if the application was started from VS
2005. Is it possible?
Also, how can I know at runtime of app is built for Debug or Release?

Thanks
Nov 18 '07 #2
bz
On 18 Noi, 10:35, "Christoph Hausner" <christoph_haus...@hotmail.de>
wrote:
You can tell Visual Studio to run your application with a special command
line argument. Click Project -Properties -Debug and enter "/debug" as an
argument. Use the following if-statement in your program to detect if it was
started from Visual Studio:

string[] args = Environment.GetCommandLineArgs(); // remove this line if
your program is a console application
if (args.Length 0 && args[0] == "/debug")
// started from VS
else
// not started from VS
Thank you
>
I'm sure there are more elegant solutions but this is one of the easiest.

"bz" <bzam...@gmail.comschrieb im Newsbeitragnews:fc******************************** **@e1g2000hsh.googlegroups.com...
Hi,
I need to detect at runtime if the application was started from VS
2005. Is it possible?
Also, how can I know at runtime of app is built for Debug or Release?
Thanks- Ascunde citatul -

- Afiºare text în citat -
Nov 18 '07 #3

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

Similar topics

0
1316
by: John Hunter | last post by:
In matplotlib using the tkagg backend, the tk mainloop is started at the end of a python script by issuing a call to a "show" function, which realizes all the created figure windows and the calls...
6
3974
by: Stephane Belzile | last post by:
Is there a way I can detect in vb.Net the power has switched to a UPS unit in case of power failure? Thanks
23
15550
by: Michel Bany | last post by:
I am trying to parse responseXML from an HTTP request. var doc = request.responseXML; var elements = doc.getElementsByTagName("*"); the last statement returns an empty collection when running from...
4
3828
by: Frank Meng | last post by:
Hi. I am trying a csharp sample from http://www.codeproject.com/csharp/socketsincs.asp . (Sorry I didn't post all the source codes here, please get the codes from above link if you want to try)....
5
11193
by: Barry Mossman | last post by:
Hi, can I detect whether my class is running within the context of a Console application, vs say a WinForm's application ? also does anyone know whether the compiler or runtime is smart enough...
1
1569
by: Marius Groenendijk | last post by:
Hi NG, I would like to implement an app that would intercept application start and possibly interrupt its startup (or kill the process immediately). For ex. see if Sol.exe is being started and...
3
1290
by: =?Utf-8?B?WHltb3g=?= | last post by:
I'm developing apps in WindowsXP which calls IBM's Websphere MQ Client. This client is a .NET application. My app is using an ActiveX wrapper in native Windows XP. When the application calls the...
24
2979
by: dE|_ | last post by:
I have started looking into scripts for screen size detect with the intention of using them to pick from a number of CSS style sheets tailored to the size. Is there a good reason why this is not...
0
3270
by: =?Utf-8?B?am1hZ2FyYW0=?= | last post by:
My program needs to do X when someone 'starts using' their Windows user account, and it should do Y when they 'stop using' their Windows user account. By 'starts using' I mean they log on, unlock...
0
7242
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,...
0
7423
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...
1
7081
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
5668
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,...
1
5066
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...
0
3225
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3213
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1576
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
781
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.