Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB in design environment or run-time environment

Windows API

VB in design environment or run-time environment

by  HermanvLimbeek  Posted    (Edited  )
I made a public function which checks the running programs in Windows to see if we're in design-time or run-time environment. If you want to disable certain checks in design-time then just call the function to see if it returns true.

Public Function TestEnv() As Boolean
Dim buffer As String
Dim EnvFileName As String
Dim Envs As Variant
Dim nRet As Long
Dim i As Long

Envs = Array("vb.exe", "vb32.exe", "vb5.exe", "vb6.exe")

For i = LBound(Envs) To UBound(Envs)
buffer = Envs(i)
nRet = GetModuleHandle(buffer)
If nRet <> 0 Then
EnvFileName = buffer
TestEnv = True
Exit For
End If
Next
End Function
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top