#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2004
    Location
    King's Lynn, Norfolk
    Posts
    2
    Rep Power
    0

    kylix, consoles and events


    Hi

    I am writing an event-driven console-based app in Kylix, which works fine, except to keep the program alive I am having to use:

    While true do
    Begin
    { Dont have anything needing to go in here }
    End;

    Which, because is empty caused the CPU to jump to 100% usage; but because all aspects of the program are handled by the event handler there is nothing that needs to go in here.

    I did try putting a Readln(var) in the loop which did cure the problem, but it killed the program when it was launched into the background.

    Does anyone know of a way to fix this little puzzle?
  2. #2
  3. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,616
    Rep Power
    4247
    Have you tried calling Application.ProcessMessages; within the loop.
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2004
    Location
    King's Lynn, Norfolk
    Posts
    2
    Rep Power
    0
    Console apps don't use TApplication so that procedure isn't available, unless you know of a way of using TApplication in console apps? I'm currently using a custom control which inherits from TComponent.

    I've tried adding that procedure to my TConApplication but it still requires bits from TApplication.

    I added QForms to my Uses list which made the procedure available, but it doubled the size of my executable binary and the app now requires X to run.

IMN logo majestic logo threadwatch logo seochat tools logo