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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditional Compile query 1

Status
Not open for further replies.
Oct 5, 1999
105
GB
I've developed a program that uses the mouse wheel by utilising calls to SetPropa etc. to hook messages in VB6 (there may be a better way, but it works).
Unfortunately this makes debugging impossible a lot of the time, so I use conditional compile statements to turn this off while developing, and then turn it back on when I make the exe. (I can manage without the scrolling while developing).

I was just wondering if there was any way using #If ... #EndIF to tell the difference between whether I'm using the Run option or the Make option? It would save me having to remember to change my #Const
 
Are you looking to see if your program is running within the IDE or not? I pulled this code from (
Code:
    Option Explicit
     
    Function RunningInVB() As Boolean
    'Returns whether we are running in vb(true), or compiled (false)
     
        Static counter As Variant
        If IsEmpty(counter) Then
            counter = 1
            Debug.Assert RunningInVB() Or True
            counter = counter - 1
        ElseIf counter = 1 Then
            counter = 0
        End If
        RunningInVB = counter
     
    End Function
     
    'Usage:
    MsgBox RunningInVB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top