title: Unable to use NDde.dll in windows service
body: <p>C# code: </p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Data;
  using System.Diagnostics;
  using System.IO;
  using System.Linq;
  using System.ServiceProcess;
  using System.Text;
  using System.Threading.Tasks;
  using NDde.Client;
  namespace Test
  {
      public partial class Service1 : ServiceBase
      {
          System.Timers.Timer timeDelay;
          int count;  
          public Service1()
          {
              InitializeComponent();
              timeDelay = new System.Timers.Timer();
              timeDelay.Elapsed += new System.Timers.ElapsedEventHandler(WorkProcess);  
          }
  
        public void WorkProcess(object sender, System.Timers.ElapsedEventArgs e)  
          {  
              string process = "Timer Tick " + count;  
              LogService(process);  
              count++;  
          }  
          protected override void OnStart(string[] args)  
          {  
              LogService("Service is Started");  
              timeDelay.Enabled = true;  
          }  
          protected override void OnStop()  
          {  
              LogService("Service Stoped");  
              timeDelay.Enabled = false;  
          }  
          private void LogService(string content)  
          {
  
              FileStream fs = new FileStream(@"C:\TestServiceLog.txt", FileMode.OpenOrCreate, FileAccess.Write);  
              StreamWriter sw = new StreamWriter(fs);  
              sw.BaseStream.Seek(0, SeekOrigin.End);  
              sw.WriteLine(content+this.GetFirefoxUrl());  
              sw.Flush();  
              sw.Close();  
          }  
  
          public string GetFirefoxUrl()
          {
              DdeClient dde = new DdeClient("Firefox", "WWW_GetWindowInfo");
              dde.Connect();
              string url = dde.Request("URL", int.MaxValue);
              dde.Disconnect();
              return url;
          }
      }
  }
  </code></pre>
  
  <p>Hi, I have written the above code but I am unable to perform the task GetFirefoxUrl(). Its giving me the following error. How can I resolve this?</p>
  
  <blockquote>
    <p>Service cannot be started. NDde.DdeException: The client failed to connect to "Firefox|WWW_GetWindowInfo".  Make sure the server application is running and that it supports the specified service name and topic name pair. ---> NDde.Foundation.DdemlException: The client failed to connect to "Firefox|WWW_GetWindowInfo".  Make sure the server application is running and that it supports the specified service name and topic name pair.
           at System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate method, Object[] args, Boolean synchronous)
           at System.Windows.Forms.Control.Invoke(Delegate method, Object[] args)
           at NDde.Advanced.DdeContext.DdeThread.Invoke(Delegate method, Object[] args)
           at NDde.Client.DdeClient.Connect()
           --- End of inner exception stack trace ---
           at NDde.Client.DdeClient.Connect()
           at Test.Service1.GetFirefoxUrl()
           at Test.Service1.LogService(String content)
           at Test.Service1.OnStart(String[] args)
           at System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(Object state)</p>
  </blockquote>
  
  <p>I have checked the other threads related to this none of them gave me a solution. I hope some one guide me to achieve this.</p>