Wrox Programmer Forums
|
Pro VB.NET 2002/2003 For advanced Visual Basic coders working .NET version 2002/2003. Beginning-level questions will be redirected to other forums, including Beginning VB.NET.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 20th, 2005, 10:27 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default Windows Service

Hello,

I'm creating a custom Windows service. I know that an application (windows forms app) can pass information to the service through a service controller's ExecuteCommand method (to the OnCustomCommand event), but can the service pass information to the application?

Brian
__________________
Brian
 
Old January 21st, 2005, 12:47 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

I reading the documentation, it seems unlikely that a service can directly pass information to an application.

However, a service can broadcast messages like any other running process, and that might be a way to send information to an application.

Additionally, ugly as it is, a service should be able to write to the disk, and you can instruct your application to monitor a specific location on the disk for the arrival of a file. (Ugly, I know.)

There might be a way to implement cross-process marshalling, but the way to do that does not immediately "leap off the page."

Perhaps you could override ExecuteCommand() with Public Sub ExecuteCommand([u]B</u>y[u]Ref</u> command As Integer), and then modify command in the processes that ensued, but I am skeptical that that would work.

I am not confident of my answer here, I’m only sharing what my perspective is on the possibility. This assertion in Visual Studio .NET help is what makes me doubt that [u]direct</u> interaction (even as [u]in</u>direct as your particular approach is) with a user (ie, another application) will be possible:
Quote:
quote:Windows Service applications run in a different window station than the interactive station of the logged-on user.1 Because the station of the Windows Service is not an interactive station, dialogs raised from within a Windows Service app. will not be seen and may cause your program to stop responding. . . .
The Windows Service classes supported by the .NET Framework do not support interaction with interactive stations, that is, the logged-on user [I’m presuming that this includes any apps the logged-on user runs]. The .NET Framework also does not include classes that represent stations and desktops. If your Windows Service must interact with other stations, you will need to access the unmanaged Windows API. For more info., see Window Stations and Desktops in the Platform SDK documentation.
1. A window station is a secure object that contains a clipboard, a set of global atoms, and a group of desktop objects.
 
Old January 21st, 2005, 03:21 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

This is the extent of creating your own service that I found: <link>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbconintroductiontontserviceapplications.asp</link>. So I'll look at alternative solutions (planning on using a "common ground" XML file).

Thanks,

Brian





Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows Service monika.vasvani ASP.NET 1.0 and 1.1 Professional 1 January 3rd, 2009 05:39 PM
Impersonate with windows service for Service A/C vinod_yadav1919 C# 0 October 18th, 2008 02:29 PM
Windows Service everest C# 1 March 8th, 2007 01:10 PM
Accessing Windows service from a windows app sajid08 C# 1 October 6th, 2006 10:25 AM
Windows Service r_ganesh76 General .NET 4 January 11th, 2005 05:08 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.