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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. NT Service

NT Service

Scheduled Pinned Locked Moved C#
designhelpcsharptutorial
2 Posts 2 Posters 0 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.
  • R Offline
    R Offline
    RickZ
    wrote on last edited by
    #1

    There must be a way? I've written many "NT Service" programs with VB6 and most have some sort of user interface. They all have an icon in the tray to indicate 'I'm running'. Now comes C#. I've written the service and installed it, but I'm having one hard time trying to figure out how to have some UI involved. I've triggered threads in the onStart() that toggle between a non-visible form which holds a notifyicon and a UI. Clicking on the icon shows a form, closing the form reloads the icon in the tray, perfect. However, after logging off then logging back on the icon moved to bit heaven, I'm assuming because there was nothing left to hold it and I don't know how to reload the form from within its called method. In VB6, its as simple as using a timer to keep attempting to put the icon in the tray. If there's an error nobodys logged in, no place to put the icon, so try again in a few seconds. When there's no error, someone must have logged in. I don't know how to see if a user has logged on to re-start the method I don't know how to write! There's got to be a way to simply have a "service process", owned and operated by the 'system' display its own icon from its own process when it knows its running and have it be there after a user logs back on. I stress owned by the "system" because due permissions available on the target machine, the polling of service manager with normal user rights can not be done. These boxes are really locked down, so the administrator has to install the program and the system has to run it. Can anyone please help?

    H 1 Reply Last reply
    0
    • R RickZ

      There must be a way? I've written many "NT Service" programs with VB6 and most have some sort of user interface. They all have an icon in the tray to indicate 'I'm running'. Now comes C#. I've written the service and installed it, but I'm having one hard time trying to figure out how to have some UI involved. I've triggered threads in the onStart() that toggle between a non-visible form which holds a notifyicon and a UI. Clicking on the icon shows a form, closing the form reloads the icon in the tray, perfect. However, after logging off then logging back on the icon moved to bit heaven, I'm assuming because there was nothing left to hold it and I don't know how to reload the form from within its called method. In VB6, its as simple as using a timer to keep attempting to put the icon in the tray. If there's an error nobodys logged in, no place to put the icon, so try again in a few seconds. When there's no error, someone must have logged in. I don't know how to see if a user has logged on to re-start the method I don't know how to write! There's got to be a way to simply have a "service process", owned and operated by the 'system' display its own icon from its own process when it knows its running and have it be there after a user logs back on. I stress owned by the "system" because due permissions available on the target machine, the polling of service manager with normal user rights can not be done. These boxes are really locked down, so the administrator has to install the program and the system has to run it. Can anyone please help?

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      I just covered this the other day. See http://www.codeproject.com/script/comments/forums.asp?msg=790002&forumid=1649&mode=all&userid=46969#xx790002xx[^] for more information.

      Microsoft MVP, Visual C# My Articles

      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