Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Windows Service and SystemFileWatcher

Windows Service and SystemFileWatcher

Scheduled Pinned Locked Moved C#
beta-testingquestioncode-review
3 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    KaptinKrunch
    wrote on last edited by
    #1

    Hi, Can a windows service run a console application? Basically my goal is to have a windows service with a FileSystemWatcher monitor a directory. If that directory has any MS Word documents in it, convert them to pdf and then move them to their final resting place. I've created the windows service, it finds the files and starts a MS Word in the background. But on the line that opens a document, it fails. I presume because its running from a windows service and MS Word is probably trying to display some dialog. So my thinking is that if I move the conversion functionality to a console app and just let the windows service do the monitoring it will work. Thanks for the feedback!

    Just because we can; does not mean we should.

    D 1 Reply Last reply
    0
    • K KaptinKrunch

      Hi, Can a windows service run a console application? Basically my goal is to have a windows service with a FileSystemWatcher monitor a directory. If that directory has any MS Word documents in it, convert them to pdf and then move them to their final resting place. I've created the windows service, it finds the files and starts a MS Word in the background. But on the line that opens a document, it fails. I presume because its running from a windows service and MS Word is probably trying to display some dialog. So my thinking is that if I move the conversion functionality to a console app and just let the windows service do the monitoring it will work. Thanks for the feedback!

      Just because we can; does not mean we should.

      D Offline
      D Offline
      DaveyM69
      wrote on last edited by
      #2

      Your service can launch a console app (invisible if necessary) and pass arguments to it etc... so pass the filename to be opened to the console app and let that handle the word/pdf stuff.

      Dave

      K 1 Reply Last reply
      0
      • D DaveyM69

        Your service can launch a console app (invisible if necessary) and pass arguments to it etc... so pass the filename to be opened to the console app and let that handle the word/pdf stuff.

        Dave

        K Offline
        K Offline
        KaptinKrunch
        wrote on last edited by
        #3

        Thank you

        Just because we can; does not mean we should.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups