|
Thanks for the reply, leppie. Actually, I'm programming in VB.NET, so the escape charectors don't exist, which is unfortunate (whatever moron at Microsoft decided that Microsoft.VisualBasic.vbCrLf was better than \n needs to be shot). The code seems to run fine when it's from a command line app, so I'm gonna try putting the meat of the thing in a command line app, and just have the Service itself spawn it.
Kyosa Jamie Nordmeyer - Cho Dan
Portland, Oregon, USA
|
|
|
|
|
You need to set the service to run under a user account with permission to access the file. By default, it will run under the SYSTEM account, which has no permissions on other machines.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
|
|
|
|
|
Hey Richard. Thanks for the reply. I've tried running the process under both my name (I have system administrator rights), and as the network admin account itself, both with no success. The code seems to run fine when it's from a command line app, so I'm gonna try putting the meat of the thing in a command line app, and just have the Service itself spawn it.
Kyosa Jamie Nordmeyer - Cho Dan
Portland, Oregon, USA
|
|
|
|
|
Hi,
I have a problem with peformance counters in C#.NET.
What I want to do is get a number of packets just like the number of
send/received packet that can be found in the Status windows, if
you click at the bottom right of your screen to your network
connection icon (the two small in/out screens flashing the network
activity).
The Received Datagrams/sec decription goes like that:
Datagrams Received/sec is the rate, in incidents per second, at
which IP datagrams are received from the interfaces, including those
in error. Datagrams Received/sec is a subset of Datagrams/sec.
But I want PACKETS not RATE. Is there any way I could somehow use
this rate to get packets?
I want to start my application, get the counter data, do somethings,
get the counter again and found the number of packets received
through the use of my application.
I could also do the following: Run my application and while running
it, I can have a Timer in another thread getting the values of the
counter each sec. So each second I pick a value-rate of the
connection, just like the Performance monitor in Administrative
Tools (control panel) works. But even then I don't get packets.
Is there perhaps a calulation I have to do to get this?
Sure there must be a way since the network activity on the Network
Status in the right bottom on Windows can do it.
BTW, I also run into this counter: Network Interface,
counter:Packets Received/sec with the following description:
Packets Received/sec is the rate at which packets are received on
the network interface.
Same here; rate.
Please help me if possible. This has become a nightmare for me.
Thank you,
Stefanos
|
|
|
|
|
I submitted the following to the microsoft.public.dotnet.framework.windowsforms newsgroup:
I've seen a number of posts about threads, forms and controls. I
realize that you shouldn't operate directly on a control from a thread that isn't the control's creating UI thread.
What I want to know is this. In the old Win32 days, your application could create multiple what-they-call UI threads. Each thread had a message pump. You could create a window (say your frame window) on one thread, and create a child window on another thread. The messages for each window would be handled in the context of the window's creating thread.
Some posts have said you can't do that in .NET. Well, I did it.
And it sort of worked.
I created a normal C# Win Forms app. I created another thread. This new thread created a couple of controls. The key is that the
framework prevents you from using the controls's and form's Parent
property to properly hook up the window hierarchy. But you can get
the handles to the form and the controls, and you can call the Win32 SetParent API to hook them up. This works and I can handle events in the proper thread context.
I tried it using a PictureBox control and got a strange result. The strange result was that the picture box control "disappeared" if I set the BorderStyle to anything other than None. I mean, if I look for the picture box in Spy++, the window was real gone, man.
I'm hoping to have some uSoft wizard tell me a couple of things.
First, can I really not use the 1.0 framework to have multiple UI
threads, where one UI thread serves child windows of another UI
thread? Second, any idea why my experience with picture box half
worked?
Thanks. Isn't this interesting???
john.
|
|
|
|
|
jjreilly wrote:
any idea why my experience with picture box half
worked?
When the border style is changed, the underlying window is destroyed and recreated (!). Hence the handle in Spy++ vanishes. But the picture box is there again after recreation, with another handle.
Here is the key executed code :
public void set_BorderStyle(BorderStyle value) {
if (!(Enum.IsDefined(typeof(BorderStyle), value)))
throw new InvalidEnumArgumentException("value", value, typeof(BorderStyle));
if (this.borderStyle != value) {
this.borderStyle = value;
this.RecreateHandle();
}
}
protected virtual CreateParams get_CreateParams() {
CreateParams local0;
BorderStyle local1;
local0 = this.CreateParams;
local1 = this.borderStyle;
switch (local1 - 1) {
case 1:
local0.ExStyle = local0.ExStyle | 512;
break;
case 0:
local0.Style = local0.Style | 8388608;
break;
}
return local0;
}
|
|
|
|
|
Thanks. That did the trick. How did you find this out?
john.
|
|
|
|
|
I have a ASP.NET application that needs to check for changes on the client side for a file. This file is constantly being changed and I need , that everytime the file is changed to open the file and check for new data to transmit to my ASP.NET app, so what do you advise ?
Building a dotnet service(it's possible wihout com interop ?) that's is constantly checking the file on the filesystem,or using some javascript function using the filesystem object and a timer to check for changes of the file, or some other way ?
Thanks in advance,
Joao Vaz
And if your dream is to care for your family, to put food on the table, to provide them with an education and a good home, then maybe suffering through an endless, pointless, boring job will seem to have purpose. And you will realize how even a rock can change the world, simply by remaining obstinately stationary.-Shog9
Remember just because a good thing comes to an end, doesn't mean that the next one can't be better.-Chris Meech
|
|
|
|
|
I am not aware of such stuff inside the .NET CLR.
You've got dedicated functions in the WIN32 File I/O APIs, including ReadDirectoryChangesW , etc.
Now this require WIN32 interop.
Adding COM or ActiveX interfaces would allow you to execute it from Javascript code.
|
|
|
|
|
.S.Rod. wrote:
I am not aware of such stuff inside the .NET CLR.
You've got dedicated functions in the WIN32 File I/O APIs, including ReadDirectoryChangesW, etc.
Thanks , I resorted to another technique , using win32 api on one client side app , and recording the data on the database on the Server side.
.S.Rod. wrote:
Now this require WIN32 interop.
Oh well, perphaps on the 2nd version, they'll put the rest of the windows api on it (insert dreamer icon here...)
Cheers,Joao Vaz
And if your dream is to care for your family, to put food on the table, to provide them with an education and a good home, then maybe suffering through an endless, pointless, boring job will seem to have purpose. And you will realize how even a rock can change the world, simply by remaining obstinately stationary.-Shog9
Remember just because a good thing comes to an end, doesn't mean that the next one can't be better.-Chris Meech
|
|
|
|
|
This class implements the equivelent Win API calls to monitor a file, or change in a directory.
System.IO.FileSystemWatcher
Quote from a clever bloke :
"I know not with what weapons World War III will be fought, but World War IV will be fought with sticks and stones." - Albert Einstein
|
|
|
|
|
Yo!
|
|
|
|
|
I'm guessing that the kitchen sink is in there somewhere. The .NET class lib seems to have everything, its just a case of finding it.
Quote from a clever bloke :
"I know not with what weapons World War III will be fought, but World War IV will be fought with sticks and stones." - Albert Einstein
|
|
|
|
|
What we are lacking is a Find option in Anakrino! (unfortunately, I have tried to recompile this masterpiece but couldn't download everything required to do so).
|
|
|
|
|
Could have a look at System.IO.FileSystemWatcher
Quote from a clever bloke :
"I know not with what weapons World War III will be fought, but World War IV will be fought with sticks and stones." - Albert Einstein
|
|
|
|
|
Giles wrote:
Could have a look at System.IO.FileSystemWatcher
This resolves the things on the server-side, and since I already resolved the client-side problem
Thanks
Cheers,Joao Vaz
And if your dream is to care for your family, to put food on the table, to provide them with an education and a good home, then maybe suffering through an endless, pointless, boring job will seem to have purpose. And you will realize how even a rock can change the world, simply by remaining obstinately stationary.-Shog9
Remember just because a good thing comes to an end, doesn't mean that the next one can't be better.-Chris Meech
|
|
|
|
|
This may be totally wrong forum, but I couldn't find a general forum for Visual Studio .NET.
Is there a way to put my own .NET user controls in the IDE toolbox and then just drag and drop them onto my forms? That would be very nice indeed.
--
"It is amazing how f-ing crazy I really am."
|
|
|
|
|
Right click the toolbox, select Customize toolbox..., browse for your assembly, and there . Magic! All Component derived classes will be on the toolbox, ready to drag onto the form. NOTE: youre class MUST have a default constructor.
MyDUMeter: a .NET DUMeter clone
|
|
|
|
|
Sweet!
I didn't spot the Browse button before. This is excellent! VS.NET is even smart enough to not lock the assembly. (The control I'm working on is in the same project, thus it's possible to recompile/link)
Thanks for your reply!
--
"It is amazing how f-ing crazy I really am."
|
|
|
|
|
Jörgen Sigvardsson wrote:
VS.NET is even smart enough to not lock the assembly. (The control I'm working on is in the same project, thus it's possible to recompile/link)
It would be easier to click (in project), Add, Inherited UserControl and select the control. Also gives you more control over the UI.
MyDUMeter: a .NET DUMeter clone
|
|
|
|
|
Jörgen Sigvardsson wrote:
Is there a way to put my own .NET user controls in the IDE toolbox and then just drag and drop them onto my forms? That would be very nice indeed.
In the next version of VS.NET (2003) it gets easier. Tt has a tab dedicated to user controls in your project so you can just drag/drop from there. The functionality is there in VS.NET 2002 (user controls are at the very bottom of the Windows Forms tab), but it is a bit buggy in that sometimes it doesn't show the controls.
I'm not sure if either version will show user controls that are contained in other projects than the one you are working on.
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|
|
James T. Johnson wrote:
In the next version of VS.NET (2003) it gets easier. Tt has a tab dedicated to user controls in your project so you can just drag/drop from there.
Heh, that's how I imagined it should work! I think I've dragged pretty much everything in VS.NET that's detachable into that damn toolbox. Thanks to leppie, I sorted it out though. I did manage at one point to drag the code(!?) of the control into the toolbox.
James T. Johnson wrote:
I'm not sure if either version will show user controls that are contained in other projects than the one you are working on.
It would be nice if it would work like many Java IDE's: You register a user control as "reusable" and it'll be in the IDE for future use. Preferrably you can label it with a category tag such as "Textboxes", "Listviews", etc. And of course, the IDE should report what assemblies these controls live in so you don't have to search for them all night just before shipment day..
I often find myself reimplementing wheels over and over again. I think this would save me a couple of hours per project. This was possible in VC6 with ActiveX controls, I see no reason why it couldn't be the same in VS.NET with .NET controls.
--
"And God said, Let us make man in our image"
|
|
|
|
|
How to add new Components to Process.Container property?
I get a null object reference error when using Process.Container.Add().
|
|
|
|
|
Hi all,
Does anyone have a nifty workaround for the fact that a class that uses XML Serialisation is required to have a default constructor?
I've got a class AuthorInfo, that has a readonly ID variable, that is set in the constructor:
//C# Class...
public class AuthorInfo
{
public readonly m_ID;
public AuthorInfo( uint ID )
{
m_ID = ID;
...
...
}
...
...
}
I'd like this class to be serialised to XML but as noted in MSDN:
"A class must have a default constructor to be serialized by XmlSerializer"
I don't really want to create a default constructor for this class, as I'd like to enforce the fact that it can't be created without an ID being supplied.
Can anyone think of a good way to do this? The only thing I can think of off the top of my head is to create an internal helper class that just deals with Serialisaton. That seems a bit messy to me, and would be awkward to use with Web Services (which is what I'm doing).
Any suggestions/comments appreciated...
TIA,
Pete
|
|
|
|
|
You could use a Static Constructor to initialise an internal static countID variable to zero, that just gets incremented and stored in a non-static member as a new ID in the default constructor. Other than that and what relationship the ID has to other data its a little difficult to say.
Quote from a clever bloke :
"I know not with what weapons World War III will be fought, but World War IV will be fought with sticks and stones." - Albert Einstein
|
|
|
|
|