Join 136,104 C# Programmers for FREE! Get instant access to thousands of C# experts, tutorials, code snippets, and more! There are 1,698 people online right now. Registration is fast and FREE... Join Now!
error says im missing directive or assembly method
CODE
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms;
namespace Service { public partial class Form1 : Form { public Form1() { InitializeComponent(); }
You are going to need to add a reference to System.ServiceProcess to your project.
Goto the project menu and select Add Reference...scroll down the list on the .NET tab until you find System.ServiceProcess and put a check in the box. Then click the OK button.
Now add the directive I gave you in my first post to your project and your good to go.
You are going to need to add a reference to System.ServiceProcess to your project.
Goto the project menu and select Add Reference...scroll down the list on the .NET tab until you find System.ServiceProcess and put a check in the box. Then click the OK button.
Now add the directive I gave you in my first post to your project and your good to go.
i added the directive and that solved that probelm, so i tried using it to stop the clock (W32Time) and it crashed with the error below in the picture file..... any ideas?
It appears that W32Time service only runs on Windows 2000, at least from what I have been able to find.
If you click the "View Detail.." link at the bottom of the error message you will find that the Inner Exception states that the service is not running. That is why you are getting an InvalidOperationException.
Actually w32time runs on XP as well, and most versions of Windows I do believe. I had a time synchronizing issue on my computer (running XP) and had to stop and start w32time to fiz it.
Ah, I see..couldn't find much searching for w32time, but when I searched for "Windows Time Synchronization service" then bingo.
This service is only running on 2 of 3 computers at my house. Just so happens I was working on the computer that doesn't have the service running. Go figure.
Anyway back to the problem at hand, matthewhaigh, I would suggest checking to see if the service is actually running on your computer. It may not be running and this could be why you are getting the error message. To check if it is already running, right click on the My Computer icon on your desktop and select "Manage" from the menu. Open "Services and Applications" by clicking the little plus sign next to it. Select Services and on the right side of your screen you will see all the services on your computer. Scroll the list and look for "Windows Time", select it, then look up in the left corner (red box) and see if the service needs to be started. See screenshot below, as you can see it is not currently running on my computer. Although I started it after I posted this.
Ah, I see..couldn't find much searching for w32time, but when I searched for "Windows Time Synchronization service" then bingo.
This service is only running on 2 of 3 computers at my house. Just so happens I was working on the computer that doesn't have the service running. Go figure.
Anyway back to the problem at hand, matthewhaigh, I would suggest checking to see if the service is actually running on your computer. It may not be running and this could be why you are getting the error message. To check if it is already running, right click on the My Computer icon on your desktop and select "Manage" from the menu. Open "Services and Applications" by clicking the little plus sign next to it. Select Services and on the right side of your screen you will see all the services on your computer. Scroll the list and look for "Windows Time", select it, then look up in the left corner (red box) and see if the service needs to be started. See screenshot below, as you can see it is not currently running on my computer. Although I started it after I posted this.
yea i checked and its running... basically i was just using it as an example servcie to stop, i want to make a service stopper to block the netsupport software at college. Basically it runs around a service called client32.exe from what i can gather and because i can't access the task manager i was trying to create an alternative to stop servcies with
Then can you post the Inner Exception message that you are receiving on the error message when it is thrown. That may provide a better indication of the problem. Click "View Detail..", click the little plus symbol next to the exception and post the Inner Exception message.
Now that the service is running on my computer, I am having no problem starting and stopping it through code.
yea i checked and its running... basically i was just using it as an example servcie to stop, i want to make a service stopper to block the netsupport software at college. Basically it runs around a service called client32.exe from what i can gather and because i can't access the task manager i was trying to create an alternative to stop servcies with mat
So in all actuality you're asking us for help in writing an application that will circumvent security they have setup for the workstations at your school? Now that this is in the open do you really think we're going to help you further in your endeavor?
As far as I'm concerned what you're trying to do falls under this category, unless you can prove me wrong
yea i checked and its running... basically i was just using it as an example servcie to stop, i want to make a service stopper to block the netsupport software at college. Basically it runs around a service called client32.exe from what i can gather and because i can't access the task manager i was trying to create an alternative to stop servcies with mat
So in all actuality you're asking us for help in writing an application that will circumvent security they have setup for the workstations at your school? Now that this is in the open do you really think we're going to help you further in your endeavor?
As far as I'm concerned what you're trying to do falls under this category, unless you can prove me wrong
tbh its just a challange lol a little fun thats how they see it, the I.T tutors 'n' all
QUOTE(jayman9 @ 14 Nov, 2007 - 04:43 PM)
Then can you post the Inner Exception message that you are receiving on the error message when it is thrown. That may provide a better indication of the problem. Click "View Detail..", click the little plus symbol next to the exception and post the Inner Exception message.
Now that the service is running on my computer, I am having no problem starting and stopping it through code.