VB.NET - Notify a user through vb.net using windows service

Asked By Ben Sebuabe on 28-Jan-13 09:47 AM
I''m using vb.net 2008 and sql 2008 and I want a message to be displayed to a user when the vb program is not running.
I have been able to display the message, but that's when the Vb program is running.  Is the anyway to display the message when the Vb project is not lauched or run? I thought of Windows Service, but do not not how to go about it. Thanks in advance.
dan scan replied to Ben Sebuabe on 28-Jan-13 10:18 AM
You will need something is running at regular intervals.  A windows service that starts up at start up and runs all day would handle this.  You will need to do a loop with a waiting thread (sleeping) that checks every minute or so.  This window service could call the sql database for status or check on other information to display.

Your window service would do something like this.
sub MainLogic
        'do logic here to determine if application is running (check database for a heartbeat maybe?)
     Thread.Sleep(sleep) //sleep equals your interval for waiting. I recommend as long as possible for your needs.

end sub

Your main vb.net application could write a heart beat to the database.  Your window service could look at the last heartbeat and if it is too long ago show the message the application is not running.