Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 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
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 5th, 2006, 03:01 PM
Registered User
 
Join Date: Sep 2006
Location: Karachi, Sindh, Pakistan.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Accessing Windows service from a windows app

Hi All,

I've a desktop application, which has a local db, and a master copy of that db is on server, so we need to synch.

For synchronization we've made a separate Windows service, so that it can run separately from the application and synch. and when the application starts it should stop, so that synching of the tables dont disturb the user interface.

Now that Windows Service needs to know few things from the main application, like on the event when the user Enables his sharing in the application, I need to tell this to the service, and pass on the database credentials to it from the main application, which it can use for synching, prior to this event it'd do nothing.

   1. How can I stop the service, when the application starts?
   2. For passing info from application to Service, how do I set it?, One idea thats in my mind, is have a public method in the Service class like

public bool SetProperties(string DbLogin, string, DbPassword, string DBName)
{
  Properties.Settings.Default.DBLogin = DBLogin;
  Properties.Settings.Default.DbPassword= DbPassword;
  Properties.Settings.Default.DBName= DBName;
}

and call it on the EnableSharing event from the application, but I am confused on how to get the active instance of the Service, I can add the reference of the dll of Service, but would that give me access to the service, which is currently stopped?

   3. Is there a better way to do what I am trying to do?


Thanks for your time,
Regards,
Sajid.



Reply With Quote
  #2 (permalink)  
Old October 6th, 2006, 10:25 AM
Registered User
 
Join Date: Sep 2006
Location: Karachi, Sindh, Pakistan.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Waiting for replies....

Reply With Quote
Reply


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
Can't Debug Windows App? Ron Howerton Visual Studio 2005 5 November 30th, 2007 05:20 PM
Accessing SQL Server from a Windows Service jeffgruending Pro Visual Basic 2005 3 November 21st, 2007 05:18 PM
Windows Standalone app echovue Visual Basic 2005 Basics 3 March 12th, 2007 03:27 PM
Works under App but not under Windows service floydus C# 0 February 12th, 2007 11:40 AM
Calling windows app from web service .. André G.Agayby Classic ASP Basics 1 August 1st, 2005 05:57 PM



All times are GMT -4. The time now is 04:23 AM.


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