How to detect if the code is running on the IDE [SOLVED]

Post

Posted
Rating:
#1 (In Topic #1008)
Regular
JumpyVB is in the usergroup ‘Regular’
How do I check in my code whether its running a) in the gambas development environment Run/Debugging or b) in the "Maked executable".
Online now: No Back to the top

Post

Posted
Rating:
#2
Regular
vuott is in the usergroup ‘Regular’

Europaeus sum !

<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
Online now: No Back to the top

Post

Posted
Rating:
#3
Regular
JumpyVB is in the usergroup ‘Regular’
Thank you vuott

Code (gambas)

  1. Public Sub DebuggerIsAttached() As Boolean
  2.  Return Not (Args[0] Like "*.gambas")
  3.  
Online now: No Back to the top

Post

Posted
Rating:
#4
Guru
BruceSteers is in the usergroup ‘Guru’
I used to check the filename but it's not entirely reliable if you rename the exe to not have the .gambas ext or use a link (with no ext), but then i found a better way.

Check this out…
/lang/.if - Gambas Documentation

 Exec is set to true for a compiled exe but not when debugging in IDE

So just have something like this in your startup class…

Code (gambas)

  1.  
  2.  
  3. Public sub Form_Open()
  4.  
  5. #If Not (Exec)  
  6.  IsIDE = True
  7. #Endif
  8.  
  9.  
  10.  

With this method if your exe or the link to it has been renamed to not have the .gambas extension it will still work as expected.
Online now: No Back to the top

Post

Posted
Rating:
#5
Regular
JumpyVB is in the usergroup ‘Regular’
Thanks Bruce. I will use this.
Online now: No Back to the top
1 guest and 0 members have just viewed this.