[기타] [vb.net] 코드가 실행 상태 즉 디버그 모드인지 아닌지에 따라서 실행되게 하기
하나를하더라도최선을
2019-09-19 10:01
7,900
0
본문
<DllImport("kernel32.dll", CharSet:=CharSet.Auto, ExactSpelling:=True)>
Public Function IsDebuggerPresent() As Boolean
End Function
If IsDebuggerPresent() Then
MsgBox("디버그모드")
Else
MsgBox("디버그 아님")
End If
또는
If Debugger.IsAttached Then
MsgBox("디버그모드")
Else
MsgBox("디버그 아님")
End If
아래는 실제 Debug 모드로 빌드 된 것인지 Release 모드로 빌드 된 것인지에 따라서 실행이 달라진다.
난 이 방법을 아주 사랑한다.
#If DEBUG Then
MessageBox.Show("Debug")
#Else
MessageBox.Show("Release")
#End If
댓글목록0