Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > Pro VB.NET 2002/2003
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 20th, 2005, 10:27 AM
Friend of Wrox
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default Windows Service


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?

Reply With Quote
  #2 (permalink)  
Old January 21st, 2005, 12:47 PM
Friend of Wrox
Join Date: Nov 2004
Location: Port Orchard, WA, USA.
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts

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: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.
Reply With Quote
  #3 (permalink)  
Old January 21st, 2005, 03:21 PM
Friend of Wrox
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts

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).


Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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

All times are GMT -4. The time now is 03:50 PM.

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