Detecting IDE Environment

F

fedrok

HI!
Here is my problem: I need to detect when a sub run in Microsoft
Visual Studio IDE, or in an exe stand alone file (deployed!).

With old Visual Basic 6.0 the trick was this:


Private Function RunningIDE() As Boolean
RunningIDE = True
On Error Resume Next
Debug.Print 1 / 0
If Err.Number = 0 Then
RunningIDE = False
End If
On Error GoTo 0
End Function


RunningIDE returns true when my program is in DEBUG mode, in Visual
Studio IDE else returns false!

How can I do the same in Visual studio .NET?????

:(

thx!
:blush:ops:
 
A

Armin Zingler

fedrok said:
HI!
Here is my problem: I need to detect when a sub run in Microsoft
Visual Studio IDE, or in an exe stand alone file (deployed!).

With old Visual Basic 6.0 the trick was this:


Private Function RunningIDE() As Boolean
RunningIDE = True
On Error Resume Next
Debug.Print 1 / 0
If Err.Number = 0 Then
RunningIDE = False
End If
On Error GoTo 0
End Function


RunningIDE returns true when my program is in DEBUG mode, in
Visual Studio IDE else returns false!

How can I do the same in Visual studio .NET?????

It runs /always/ in an exe (as a seperate process in opposite to VB6) now.
Maybe you want to find out whether a debugger is attached to the process to
be debugged. Have a look at System.Diagnostics.Debugger.IsAttached.


--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top