Visual Basic Core Snippet Routines
IsInIDE (api version)
   Returns True if the application is running in the development environment..         
           Updated:   Monday December 26, 2011   
click to copy code:  

   Applies to:   VB5, VB6   
OS restrictions:   None  
 Code Snippet
' Copyright 1996-2011 VBnet/Randy Birch, All Rights Reserved.
' Some pages may also contain other copyrights by the author.
' Distribution: You can freely use this code in your own
'               applications, but you may not reproduce 
'               or publish this code on any web site,
'               online service, or distribute as source 
'               on any media without express permission.
Private Const MAX_PATH As Long = 260

Private Declare Function GetModuleFileName Lib "kernel32" _
   Alias "GetModuleFileNameA" _
  (ByVal hModule As Long, _
   ByVal lpFileName As String, _
   ByVal nSize As Long) As Long
Private Function IsInIDE() As Boolean

   Dim buff As String
   Dim success As Long
   buff = Space$(MAX_PATH)
   success = GetModuleFileName(App.hInstance, buff, Len(buff))
   If success > 0 Then
     'Change the VB exe name here as appropriate 
     'for your version. The case change ensures this 
     'works regardless as to how the exe is cased on
     'the machine.
      IsInIDE = InStr(Lcase$(buff), "vb6.exe") > 0
   End If

End Function

 Calling Syntax
   If IsInIDE() Then
      <IDE-specific code>
      <EXE-specific code>
   End If

 Comments / Related
demo in use:   RegQueryValueEx: Identify Time Zones by Time Zone Bias  
Related:   IsInIDE  


PayPal Link
Make payments with PayPal - it's fast, free and secure!


Copyright 1996-2011 VBnet and Randy Birch. All Rights Reserved.
Terms of Use  |  Your Privacy


Hit Counter