Set/GetEnv

BlitzPlus Forums/BlitzPlus Programming/Set/GetEnv

Ive been experimenting with SetEnv and GetEnv to detect multiple instances of my program, I got the idea from Snarty. The problem is i've followed his code exactly and it doesnt seem to work.

tmp% = GetEnv("im_running")
Notify tmp%
If tmp% = 1 Then End

SetEnv "im_running", "1"

Graphics 320, 240, 16, 2
SetBuffer BackBuffer()
While Not KeyDown(1)

Flip
Wend

SetEnv "im_running", "0"
End

Compile that in B+ and run the exe twice. The first one should run and set the flag to 1, the second should read the one and end. For me it always returns 0. Can anyone help?