Stuart McLachlan
stuart at lexacorp.com.pg
Fri Jul 8 17:36:03 CDT 2011
Best prectice is for a service to not interact with the desktop in any way. Your service and your GUI should be separate applications. The GUI and service should communicate with each other through some form of Inter Process Communication (IPC). If the server and GUI will always run on the same workstation a good choice would be file mapping using named shared memory, (See http://msdn.microsoft.com/en-us/library/aa366556%28v=VS.85%29.aspx ) The server can then use SendNotifyMessage() with HWND_BROADCAST to tell any active GUI to check for updated data in the mapped file. -- Stuart On 8 Jul 2011 at 14:23, Francisco Tapia wrote: > Hey gang, > This thread I wanted to start to help cover some best practices when > it > comes to programming, since we don't have a C# group I figured vb.net > is close enough :). I was wondering how to approach my current > scenario. > > I'm building a really rather simple windows service. It monitors a > folder share on the network and whenever a new file is created it > takes a look at it and streams the contents to read for particular > pieces of data. Once the target data is obtained, the stream is > closed and the data is then inserted into a Sql Server database. > > simple. > > I'm thinking that the threaded process should have some events it > advertises that the gui can hook into right? the other way to get > this to work would be to just eliminate the gui updating from the > tread and have it read right off the log.txt file streamed in? what > are your thoughts?