470,849 Members | 1,249 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,849 developers. It's quick & easy.

how to know when an app is running in the VS IDE

Is there a straight-forward way to know when an app is running in the VS IDE
(versus the EXE) ??

Thanks
Apr 26 '06 #1
5 1275
Mark,

Assemblies do not execute in the IDE like it seemed to do in VB4/5/6 days.
Even an uncommitted project will create a temporary assembly and execute
that. The IDE will hook into the executing assembly with tracelisteners and
other novel items from the system.diagnostics namespace.

Each assembly can be assigned a "Build Mode" (Release, Debug). You could
perhaps get away with just testing for that. Otherwise, look at the
application's tracelisteners, perhaps there is a way to determine it from
there.
"Mark" <ma******@blaisesoft-xxx.com> wrote in message
news:OV*************@TK2MSFTNGP03.phx.gbl...
Is there a straight-forward way to know when an app is running in the VS
IDE (versus the EXE) ??

Thanks

Apr 26 '06 #2
Why not use arguments when you open your app with the IDE?!
Apr 26 '06 #3
> Is there a straight-forward way to know when an app is running in the VS IDE
(versus the EXE) ??


If System.Diagnostics.Debugger.IsAttached is true, then you are running
under some debugger, possibly (probably?) the VS IDE.
Apr 26 '06 #4
"DHarry" <DH****@discussions.microsoft.com> wrote in message
news:EF**********************************@microsof t.com...
Why not use arguments when you open your app with the IDE?!


fwiw, here's some code that involves setting the 'design time' command line
to some "extremely hard to type" argument and testing for that to "assume"
IDE... fwiw, I got those characters from the character map utility. They're
Chr$(&HEE), Chr$(&HD0) and Chr$(&HCA), in case people can't see them here,
they spell "IDE"
'======
Public Class Form1
Private mbRunningIDE As Boolean

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Command() = "īŠŹ" Then
mbRunningIDE = True
End If
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
If mbRunningIDE Then
MsgBox("We're running in the IDE")
End If
End Sub
End Class
'======

--
Ken Halter - MS-MVP-VB (visiting from VB6 world) - http://www.vbsight.com
Please keep all discussions in the groups..
Apr 26 '06 #5
Thanks for the suggestions everyone ... I was really hoping for something
simple like My.Application.IsRunningInIDE

Such is life ... :-)
"Mark" <ma******@blaisesoft-xxx.com> wrote in message
news:OV*************@TK2MSFTNGP03.phx.gbl...
Is there a straight-forward way to know when an app is running in the VS
IDE (versus the EXE) ??

Thanks

Apr 28 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Juan Manuel Alegrķa B. | last post: by
5 posts views Thread by DaWoE | last post: by
4 posts views Thread by Juan Manuel Alegrķa B. | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.