Is it impossible to make app without form?

conf

Member
I write a little program without "Form1.Show" code. It didn't show the form but not work OK. Please show me how to make app to be "hide in system tray". Thank you so much.
 

RandomCoder

Well-Known Member
Licensed User
Longtime User
Erel,

This has got me thinking as it's a subject that crops up from time to time.

I work with Kawasaki robots which use a programming language called AS. It too runs once and then ends but can be made to run continuously either using the robot controller or within the code my forming an endless loop.

My question is this.... is it possible to program an endless loop in App_Start without tying up all of the devices memory?
I was thinking of something like:-
B4X:
Sub App_Start
InitBitsAndBobs  'General code to run once
...
...
Begin: 'Label to loop round
...
...
... 'Program statements If this happens do something else etc
...
...
GoTo Begin
End Sub

To break the loop you could have an exit option. But do you think that endlessly running around the loop looking for events would cause the device to hang?

Regards,
RandomCoder
 

RandomCoder

Well-Known Member
Licensed User
Longtime User
You can use Sleep() inside the loop so it won't take too much resources.

Once again I've learnt something for today, that's a function I never knew existed.

:sign0188:

Regards,
RandomCoder
 

conf

Member
My code:

B4X:
Sub Globals

End Sub

Sub App_Start
   Sound("sound.wav")
End Sub

When I run (F5) in B4P editor it's work but when I compile (device EXE & desktop EXE) it's not work. Yes, I copied "sound.wav" to the folder contains EXE file. What's the problem ?
 

specci48

Well-Known Member
Licensed User
Longtime User
Hi conf,

try to add a Sleep(1000) after the sound instruction (works on desktop, I haven't tested on device yet). I think the application ist closed before the sound command can be executed.


specci48
 
Top