1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

C++ code to run as a Windows Service ?

Discussion in 'Software Development' started by deuce, Jul 24, 2008.

Thread Status:
Not open for further replies.
Advertisement
  1. deuce

    deuce Thread Starter

    Joined:
    May 26, 2001
    Messages:
    7,530
    Hi,

    I have some C++ code that I'm developing that I need to run as a windows service. (I think)

    First it might make sense to explain this a bit--maybe someone has a better idea on how to implement this.


    I need an application that will read data from a specific file ( YYMMDD(-1).txt That is to say, a text file named with the above date format, but with yesterday's date) everyday at noon.

    I need it to check the file for certain conditions (the conditions are a result of certain things the operator needs to be doing). If the conditions are not there, I need it to generate a plain text email to a certain email address.



    I figure the way to do this is to write a program and run it as a windows service--so it is always running, wakes up at noon, does it's business and sleeps until the next day at noon. If anyone has a better idea, I would love to hear it.


    With that said, in terms of getting C++ code to run as a windows service, can someone give me some direction in finding good info to help with this? It's been a few years since the last time I did a lot of programming, but I think I can handle the C++ code to do what I want. I just have no idea how to setup a windows service. I have searched the internet and read some things, but I haven't hit the ground runnning yet.

    These two articles were very informatitive:

    http://www.developer.com/net/cplus/article.php/10919_3293351_1

    http://msdn.microsoft.com/en-us/library/ms810429.aspx

    but I don't seem to have the same wizards as they do in my Visual Studio 2008. (didn't notice which complier (VS version) they used for their examples)


    Maybe it's just really late and I'm missing it and I should go home...but I can't seem to get the ball rolling. Any help would be appreciated.

    Going home and sleeping sounds nice--I think I'll do that in the mean time.



    By the way:

    I am using:
    Visual Studio 2008 Professional on my desktop at home
    Visual C++ 2008 Express on my workstation at work

    I am using XP Pro (x86) on my workstation
    The code will be implemented on a workstation running XP Pro (x86)


    Thanks!
     
  2. deuce

    deuce Thread Starter

    Joined:
    May 26, 2001
    Messages:
    7,530
    Also--can this be done in Visual C++ 2008 Express? Is this something that I need to stick to VS Pro for?

    Thanks!
     
  3. IMM

    IMM Malware Specialist

    Joined:
    Feb 1, 2002
    Messages:
    3,259
    Is there a reason not to use task scheduler for this?
     
  4. deuce

    deuce Thread Starter

    Joined:
    May 26, 2001
    Messages:
    7,530
    I forgot about that component in the control panel.

    I might be able to use it--it would make my code easier to write.

    Can I develop my C++ code, compile it as a .exe and set it up with the task scheduler?


    Thanks,
    Mike
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/733392