How to detect if the code is running on the IDE [SOLVED]
How to detect if the code is running on the IDE [SOLVED]
How do I check in my code whether its running a) in the gambas development environment Run/Debugging or b) in the "Maked executable".
Last edited by JumpyVB on Monday 27th March 2023 3:07pm, edited 1 time in total.
Re: How to detect if the code is running on the IDE
Europaeus sum !
Amare memorentes atque deflentes ad mortem silenter labimur.
Amare memorentes atque deflentes ad mortem silenter labimur.
Re: How to detect if the code is running on the IDE
Thank you vuott
Public Sub DebuggerIsAttached() As Boolean
Return Not (Args[0] Like "*.gambas")
End
- BruceSteers
- Posts: 1578
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: How to detect if the code is running on the IDE
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...
https://gambaswiki.org/wiki/lang/.if
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...
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.
Check this out...
https://gambaswiki.org/wiki/lang/.if
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...
Public IsIDE as boolean
Public sub Form_Open()
#If Not (Exec)
IsIDE = True
#Endif
End
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.
If at first you don't succeed , try doing something differently.
BruceS
BruceS
Re: How to detect if the code is running on the IDE
Thanks Bruce. I will use this.