New construction project in VB, add a button.
When using, the effect can be seen when F5 is running and compiled after the IDE environment.
Option expedition
Private declare function getModuleFileName LIB "kernel32" Alias _
"GetModulefilenamea" (Byval HModule As Long, Byval LPFileName AS _
String, byval nsize as long) As long
Function isrunundervb6 () as boolean
DIM S As String
DIM Length As Long
Length = 256
S = String (Length, 0)
Call getModuleFileName (0, S, Length)
S = Left (s, INSTR (S, CHR (0)) - 1)
Isrunundervb6 = ucase (Right (s, 7)) = "vb6.exe"
END FUNCTION
Private submmand1_click ()
If isrunundervb6 Then
MSGBOX "debug"
Else
Msgbox "Run"
END IF
End Sub
Take a look, relatively simple