title: windows service to run a method at definite time interval in C++
body: <p>I want to call a method periodically in a windows service built in C++. I am calling the method in SvcMain(). </p>
  
  <pre><code>int main(int argc, char* argv[])
  {  
      // The Services to run have to be added in this table.
      // It takes the Service Name and the name of the method to be called by SC Manager.
      // Add any additional services for the process to this table.
      SERVICE_TABLE_ENTRY ServiceTable[]= {{SVCNAME,(LPSERVICE_MAIN_FUNCTION)SvcMain},{NULL,NULL}};
  
      // This call returns when the service has stopped. 
      // The process should simply terminate when the call returns.
      StartServiceCtrlDispatcher(ServiceTable);  
      return 0;
  }
  
  void WINAPI SvcMain(DWORD argc, LPTSTR *argv)
  {
      ConnectToServer();
  }
  </code></pre>
  
  <p>Q1. Is this going to fire ConnectToServer() all the time or only once? I just don't know how win service works.<br>
  Q2.I want ConnectToServer() to be fired every 15 mins. How can I do that ?</p>
  
  <p>EDIT: How can I create an installer for this service?</p>