Is it impossible to make app without form?

Discussion in 'Questions (Windows Mobile)' started by conf, Jun 22, 2007.

  1. conf

    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.
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    You can create a formless application, but the application will end after Sub App_Start executation.
     
  3. RandomCoder

    RandomCoder Well-Known Member Licensed 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:-
    Code:
    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
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    It is possible to create an endless loop in App_Start.
    You can use Sleep() inside the loop so it won't take too much resources.
     
  5. RandomCoder

    RandomCoder Well-Known Member Licensed User

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

    :sign0188:

    Regards,
    RandomCoder
     
  6. conf

    conf Member

    My code:

    Code:
    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 ?
     
  7. specci48

    specci48 Well-Known Member Licensed 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
     
  8. conf

    conf Member

    Thank Specci48,

    You helped me so much. It's OK !!! :D
     
Loading...