Results 1 to 2 of 2

Thread: exe file

  1. #1
    Join Date
    Dec 2008
    Posts
    59

    Unanswered: exe file

    help:-
    How do I check if Program is running in the IDE or an EXE File?

  2. #2
    Join Date
    Jun 2004
    Location
    Arizona, USA
    Posts
    1,848
    in VB5/6, a simple test is to add an error handler in a function, and try dividing by zero. If the error handler is invoked for the divide by zero runtime error, you're running in the debug mode. (Remember, debug statements aren't compiled into the exe.) The code would look something like this:
    Code:
    Private Function IsDebug() As Boolean
    
       On Error GoTo IsDebugErr
       
       Debug.Print 1 / 0
       
       Err.Clear
       On Error GoTo 0
       
       Exit Function
       
    IsDebugErr:
       
       Err.Clear
       
       IsDebug = True
       
    End Function
    Lou
    使大吃一惊
    "Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
    "I have my standards. They may be low, but I have them!" - Bette Middler
    "It's a book about a Spanish guy named Manual. You should read it." - Dilbert


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •