VB.Net Console - DoEvents???

Posted on 2004-11-01
Last Modified: 2008-02-01
Hello, my Console application, made with VB.Net 2003, need a Application.DoEvents routine!!! :(

As i understand this is not possible, then i use a simple Thread.sleep.....

This is not the same, not?
I think the use of this function should make my app more slow....and sometime busy...

Please, someone know the way to simulate a DoEvents better then the use of the Sleep function?

Thanks a lot!

Question by:SubSonicS

    Author Comment

    Ps: Let me explain more:

    My Console Application is not Alone and work with a Windows Application by Communicating by Windows Registry...

    It is like a Server and a Client..

    Every time the 'ball' is to the Windows Application, the Console Application must do something but must also wait for the 'ball' again....

    If i use the Sleep function, then the Console Freeze for the Sleep time and cannot do nothing...
    If i use this console to launch a command line tools, this will slow significally once it is in the Sleep Status...

    A Do While --- Loop naturally is the same as the Sleep one and the Console will freeze too...

    As 'ball' i mean the Read/Write turn inside the Windows Registry...

    LVL 4

    Accepted Solution

    DoEvents is only applicable for Forms based applications.

    The sleep method puts the thread that your application is on to sleep for the specific amount of time. I am not sure about the specifics, but I think that If one application starts another then they are potentially on the same thread and so what you mentioned happens.

    If you have 2 applications, interacting on the same machine, why are they seperate applications? If you combined them and threaded you application, you could acheive what you want.

    Just my thoughts.


    Author Comment

    Ok, then how to combine a Window form based project with a Console one?
    LVL 4

    Expert Comment

    By console application I am assuming you mean an interface-less application, ie a background process or Service.

    An Application can do whatever you want it to do. Many forms based applications have large amounts of code that has no interaction with the Form Interface.

    Think about most non user applications that run under windows. Most have a configuration interface that uses forms. Therefore you have a forms interface and what would be considered a console application.

    It would help if you could explain what the 2 layers do.


    Author Comment

    Hi, the explanation should require about a month, and a lot of discussions are opened for this...

    I should be more fast: i really need the Console...

    By the way, Thanks a lot!

    LVL 4

    Expert Comment


    No Problems. Can you give me some pointers to the previous discussions?

    LVL 85

    Assisted Solution

    by:Mike Tomlinson
    A Do...While Loop with a small call to Sleep *can* work.  What interval were you using?


    Author Comment

    Thanks, i already use a do while with sleep inside....

    The time i will use is indifferent...I already tried to change it...

    Any dos application started throught the shell within my console go very slow...

    Andrew, my old discussions are closed from 6 months or more, but here a summing up...

    I need to use some console application which does not make Windows based form able to read the output.
    We tried a lot of ReadPipe and stdOut...
    Most common dos based application(98%) give no problem when reading its output, but the one i need to use is very heavy...Cannot read it before it finish his work...

    The solution was very interesting...

    I builded a Console application with .Net and i applyied on that a perfect screenreader with the use of some old APIs. I don't receive the output, i really read the screen....

    Now it work perfectly, but slow because i need this Doevents...

    Hope my English could be understanded by you, because i'm Italian...

    Author Comment

    By the way, i forgot to tell you that i already create 2 other threads..
    The first to launch the application with the shell.
    The second to read its output and to communicate throught the Windows Registry...

    Then i thinked: i will give more Priority to the Shelled application and less to the Readers and Communicator...

    Then i got of only the shelled Application work correctly and the other thred stay inactive until the first end...

    eheh ;)

    Author Comment

    No solution around the world...
    All web page i found with this similar issue tell the samething: It is not possible...

    I will try more with the use of the 2 different threads...

    Thanks a lot for your time..

    Best Regards

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
    Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
    This video discusses moving either the default database or any database to a new volume.
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    884 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now