Detecting IDE Environment

  • Thread starter Thread starter fedrok
  • Start date Start date
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!
:oops:
 
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
 
Back
Top