Visual Basic
In visual basic 6.0 I want know that I am running code from exe or source code. Is there is function that can tell me or any other trick.
Let me know.
Adrehman
Developer
ZRG International
Web Development
In visual basic 6.0 I want know that I am running code from exe or source code. Is there is function that can tell me or any other trick.
Let me know.
Adrehman
Developer
ZRG International
by donq
by adrehman
by peyison
An easy way to do this is to use a compiler directive.
There are two ways to create one:
Use #Const in a code module
Or fill in the "Conditional Compilation Arguments" box on the "Make" tab of the "Project Properties" dialog
The difference is scope. The first will only be available to the module it is declared in, while the second will be available from anywhere in the project.
Here's how to use it:
In a code module:
--------------------
#Const InVBE=True
#If InVBE Then
'code for only if you're in the VB editor
#Else
'code for only when you're running from the EXE
#End If
-----------
When you're working in the VBE, set the constant to true. When you're ready to compile, set it to false.
If you use the "Conditional Compilation Arguments" box, you'd enter: InVBE=True
Hope this helps.
by adrehman
by adrehman
This discussion is closed to new replies.
Sort by Trending