code to detect IDE 
Author Message
 code to detect IDE

What code will determine at run time if execution is from within the IDE?
Bill


Sun, 18 Nov 2001 03:00:00 GMT  
 code to detect IDE

Quote:
>What code will determine at run time if execution is from within the IDE?

Try this code:

Private Sub Form_Load()
    On Error GoTo IDETest
    Debug.Print 1 / 0
    MsgBox "Running as an EXE"
    Exit Sub
IDETest:
    MsgBox "Running in the IDE"
End Sub

The Debug.Print statement causes an error only in the IDE because all Debug
statements are dropped out of the compiled EXE, like comments.

Lee Weiner
weiner AT fuse DOT net
http://home.fuse.net/lweiner



Sun, 18 Nov 2001 03:00:00 GMT  
 code to detect IDE
Hi Bill,

There are many ways to find this, but the most clever one i have seen
utilizes the fact that the Debug.Print statements are dropped from the code
at compile time.
Here is a function that will return True if your program is running in the
IDE:

Function InIDE() As Boolean
    InIDE = False
    On Error Resume Next
    Debug.Print 1 \ 0

    If Err Then
        Err.Clear
        InIDE = True
    End If
End Function

Regards,
                 Stoil

Quote:

> What code will determine at run time if execution is from within the IDE?
> Bill



Sun, 18 Nov 2001 03:00:00 GMT  
 code to detect IDE


Quote:
>What code will determine at run time if execution is from within the IDE?

The API GetModuleHandle() will return the Windows handle to a currently
running module.  If the module is not running, it returns zero.  The
following line:
    bolIDE = GetModuleHandle("vb6.exe")

sets a flag, bolIDE, that can be used within the program to determine if VB
is running.  The drawback is that if the user is running your program, and
is ALSO running VB for whatever reason, this method will not work (it just
tells if VB is running; it doesn't make tell if your app is being run from
it).



Sun, 18 Nov 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Detecting when in IDE

2. Detecting Debug while running in the IDE

3. Detecting prog run from QB IDE?

4. Detecting the ide at runtime

5. Detecting IDE environment

6. Detecting the IDE

7. How to detect VB IDE?

8. Detect VB IDE part 2

9. detecting VB development environment (IDE)

10. VBA string functions not auto-detected by IDE

11. How to detect if IDE or EXE

12. Use the VS7 IDE for writing Access 2002 code

 

 
Powered by phpBB® Forum Software