DukeBlazingstix Posted July 8, 2005 Share Posted July 8, 2005 Hi, I’ve just got a small question that’s been driving me nuts. I used to do alot of VB6 programming back in “the day” but I haven’t done any in years, and am quite a bit rusty. I now find myself in the unenviable position of having to write a few “small” programs for work.I would swear up and down that there was a simple way of telling if the program was being run through the IDE or through a compiled exe, but I can’t for the life of me remember what it is, and I just have no luck hitting the right keywords to find it on google.Does anybody have any easy, or not-so-easy methods they’d be willing to share? Link to comment Share on other sites More sharing options...
DukeBlazingstix Posted July 8, 2005 Author Share Posted July 8, 2005 Of course, wouldn’t you just know it. Not one minute after I ask the question do I find the answer on my own.Debug.Assert does not get compiled, so all I have to do is:Dim IsIDE as BooleanIsIDE=FalseDebug.Assert IsIDE=TrueAnd the EXE will never see the Debug command. Or if that syntax isn’t perfect, some such varient of that code will do the trick.For anyone who might stumble along here through google some distant day, I found this Debug.Assert method here: http://visualbasic.about.com/od/usevb6/l/blfaq0012a.htm<sigh>Now I feel like a real smeghead, answering my own questions, like I only asked so I could feel smart or something. I know I’ll be back soon enough with another question I couldn’t figure out on my own. Say... how are any of you with SQL? Link to comment Share on other sites More sharing options...
dman Posted July 8, 2005 Share Posted July 8, 2005 (edited) Glad you found it. I use something similar.Private Function devmode() As Boolean Dim ltest As Long Debug.Assert Not chkmode(ltest) devmode = ltest = 1End FunctionPrivate Function chkmode(ltest As Long) As Boolean ltest = 1End FunctionPrivate Sub Command1_Click() If devmode() = True Then MsgBox ("Development Mode") Else MsgBox ("Runtime Mode") End IfEnd SubI use it to set paths for development, since app.path returns the vb6 dir. What are you using it for.sidenote: in VFP you can do this with function version(2). Everything is so much easier in VFP. Edited July 8, 2005 by dman Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now