Can you post some code that demonstrates these differences?
Thanks for willing to help.
After showing the form I have a panel using MouseMove to move a sprite.
Then the Door library sets Visible false when the Sprite reaches an X location.
It then disables all active timers, and enables Timer4.
It also runs hook.unhook. Hook is a library i wrote to use SetWindowsHookEx and some other functions,
hook.unhook naturally unhooks the keys while the form is hidden. And Hook.New2 starts the hook.
To this point all works. The problem is that Timer4 doesn't appear to be active to set Visible to true,
and KeyDown_NewEvent won't work either.
All of this works with legacy device compile.
Some of this code is not need, as I am still debugging.
I've included my Library if you want to test.
Thanks again.
Sub Panel1_MouseMove (x,y)
Sprite.X = x - Sprite.Width + 10
If Sprite.X < 0 Then
Sprite.X = 0
Else If Sprite.X >155 Then
Sprite.X = 155
obj.New1(False)
obj.FromControl ("Form1")
obj.SetProperty ("Visible",False)
Sprite.X = 0
hook.UnHook
Timer5.Enabled = False
Timer1.Enabled = False
Timer2.Enabled = False
Timer3.Enabled = False
Timer4.Interval = 15000
Timer4.Enabled = True
led.ActivateLed(5)
Sleep(120)
led.DeActivateLed(5)
End If
Timer4 gets the idle time, sleeps for 15sec, then gets the idle time again.
To prevent Timer4 from running while in sleep state, I set it's interval high enough before sleeping so it won't run twice.
It then sets Visible to true, enables the Timers, disables Timer4, and creates a new Hook to Hook the keys.
Sub Timer4_Tick
obj.New1(False)
obj.FromControl("Form1")
obj.Value = obj.GetProperty("Visible")
If obj.Value = False Then
idletime = hook.GetIdleTime
Timer4.Interval = 150000
Sleep (15000)
idletime2 = hook.GetIdleTime
idle = (idletime2 - idletime) / 1000
Msgbox(idle)
Timer4.Interval = 15000
If idle > 10 Then
obj.New1(False)
obj.FromControl ("Form1")
obj.SetProperty ("Visible",True)
hook.New2("Form1")
Timer1.Enabled = True
Timer2.Enabled = True
Timer3.Enabled = True
Timer5.Enabled = True
Timer5.Interval = 25000
End If
End If
End Sub
Here I have a door object to GetProperty Keycode Right, to also move the Sprite. which won't when Optimized.
Hook.New2 allows KeyRight within the library.
Hook.FullOnState is setting the backlight on, after Timer5 has already set the backlight off.
From AppStart
obj.New1 (False)
obj.FromControl ("Form1")
KeyUp.New1 (obj.Value,"KeyUp")
KeyDown.New1 (obj.Value,"KeyDown")
End AppStart
Sub KeyDown_NewEvent
obj.Value = KeyDown.Data
If (obj.GetProperty("KeyCode") = "Right") Then
hook.FullOnState
Timer5.Interval = 25000
Sprite.X = Sprite.X + 15
End If
If Sprite.X >160 Then
Sprite.X = 155
Form1.Close
End If
End Sub