|
Hello!
I'm developing a windows service that is monitoring the filesystem, i need to make it write to a log BEFORE you open a file that the file is beeing opened. I can catch file change,rename,delete,create event, but i can't find anything for catching a "about to be opened" event. Anyone got suggestions?
|
|
|
|
|
In the event handler of the openning Write a call to a method that do this and when this method says that to the user, it will return and open the file.
|
|
|
|
|
hmm i'm not sure i understand.. i need to catch the event before the user opens any file in thefilesystem, to a service.. but from what i understand there is no such event in the api..
|
|
|
|
|
There is no "Opening" event.
Believe it or not, you'll have to write a file system driver. This is best done in C++ because of the HUGE amount of COM Interop your going to have to do in C# to get this to work. If done in C#, this will add quite an overhead to all file operations system-wide.
SysInternals FileMon does just this. You can find it here[^] with a short decsription of what it does and how. This is not easy if you don't know anything about HTFS internals, and as a side-note, will require you to get the Windows Device Driver Development kit which is only downloadable by MSDN subscribers. You can get it on CD though for a small fee.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I need to show the network performance just like Windows Task Manager’s Network Utilization. I am using PerformanceCounter class. It is working fine until I deploy my application on any other machine.
My code goes like :
this.performanceCounter.CategoryName = "Network Interface";
this.performanceCounter.CounterName = "Current Bandwidth";
//Following line breaks
this.performanceCounter.InstanceName = "Realtek RTL8139 Family PCI Fast Ethernet NIC - Virtual Machine Network Services Driver";
The problem is that the VS.NET 2003 hardcodes PerformanceCounter.InterfaceName in my application. I want to get this ethernet driver name at runtime. How do I do it?
Zishan
|
|
|
|
|
I am implementing a webservice that link to a database on the server machine, The operation on SELECT function work alright. However, operation such as INSERT, DELETE doesn't work at all. Could any one suggest why? I have tried various ways of INSERTing, I have tried using OleDbCommand as well as OleDbDataAdapter... but none of it works. The database I am using in MS Access though.
Thank you in advance
|
|
|
|
|
|
IIRC, when an Access db is opened, the default mode is read-only. SELECT will work fine, but any attempt to modify the data will fail, regardless of user permissions.
There are optional flags that can be set while creating the connection which override the defaults, though I don't remember where they're defined at the moment. Try MSDN - I was working with ADO when I bumped into this, so that might be a good section to start searching.
Boredom, Bull$^%&, Baggage, Bar - all start with 'B' Coincidence?
|
|
|
|
|
i want to make a dynamic form which creat its buttons like that for ex:
i have static 3 buttons : 1 , 2 and 3 at left and a panel at right
when i press button 1 it creat in the panel 3 butoons a , b and c
when i press button 2 it creat in the panel 2 buttons d and e
when i press button 3 it creat in the panel 5 buttons f , g, h , i and j
misho
|
|
|
|
|
|
yeah be sure that you included the created button on the panel by the following code
//here to add the class button to your panel
panel.Controls.Add(mybutton);
try this and tell me what happened ..
Miss With The Best And Die Like The Rest
|
|
|
|
|
Is wrapping every C++ classes in C# classes the only way to allow interopability between a C# application and a C++ DLL?
|
|
|
|
|
Hi,
I am using Visual Studio 2005 Beta 2 to create a 64bit application. The problem is that i have a com component that i need to reference from my c# application. I cannot add a reference to the com component. Basically, my 64 bit com object does not show up in the list of com components(it registers successfully) under the add reference tab and when i browse for the com component, trying to add it results in an error.
Has anyone run into this problem? Any suggestions?
Thanks.
|
|
|
|
|
I VC++ if you creaed a function to do a specific thing you first referenced it in the header file then added to the cpp file.
Example:
Header:
int myFunc();
CPP:
int CMyClassDLG::myFinc()
{
}
So in C# I created this dialog based app. I added a function to get all the nic listed on my machine. Called the function GetNics(). How do I call this?
When I try and call this in Main() is says something about
"C:\My Documents\Visual Studio Projects\MyNetwork\Form1.cs(111): An object reference is required for the nonstatic field, method, or property 'MyNetwork.Form1.GetNics()'"
So do I need to create a new class for each new function I want to do?
Can someone point me in the right direction?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Okay I think I may have found it. Can I not call any functions in the Main portion of my code? What I was doing was trying to load up a dropdown list when the form first loaded. I found out that by double clicking on the form created a function call Form1_Load in whick I could call my functions. So is this how I am supposed to do it?
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
In the Main function you can only call other static functions in that class. Otherwise you must put your functions in a separate class and then new the class in Main and then call the function on that class.
Kevin
|
|
|
|
|
If you want to call the GetNics() method in the class it beongs to, you just call it as GetNics() , if you call it outside the class you have to create an instance of the owner class and then call it as 'instanceNameHere.GetNics()'
For only static methods you can use ClassNameHere.MethodNameHere()
Good luck.
|
|
|
|
|
I'm not sure what you mean by this,
Utku KAYA wrote:
'instanceNameHere.GetNics()'
Here is my code:
static void Main() <br />
{<br />
Application.Run(new Form1());<br />
MyNetwork.LoadNics(); <br />
<br />
}<br />
<br />
private void Form1_Load(object sender, System.EventArgs e)<br />
{<br />
LoadNics();<br />
}<br />
<br />
private void LoadNics()<br />
{<br />
ArrayList nicName = WMIHelper.GetNics();<br />
<br />
NICScb.Items.Clear();<br />
foreach ( String name in nicName)<br />
{<br />
NICScb.Items.Add(name);<br />
}<br />
if (NICScb.Items.Count > 0)<br />
{<br />
NICScb.SelectedIndex = 0;<br />
}<br />
<br />
}<br />
<br />
}<br />
I still get an error in the main function. I read that the main function does not belong to the object, so I see what you mean by referencing the instance. But it still errors out. Can you explain some more for me?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
By placing the LoadNics() method into the FormLoad event, it means that every time the forms get created (or, if u prefer, the class gets intantiated) the LoadNics() method will be executed.
Just cut & paste the LoadNics() method call from the FormLoad event into the Main() method of your class. So your new Main() class would consist something like:
static void Main()
{
Application.Run(new Form1());
LoadNics();
}
Regards,
Polis
Can you practice what you teach?
|
|
|
|
|
|
That does not work. I've tried it several times. The problem is that while Main belongs to the class rather than any particular object of the class, my LodNic() function belongs to a particular object of the class...this is why it is not a static function, and why it errors out.
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Greeting,
i am working on a Project which uses Database for almost information, that is mostly it is concerned with view of information stored in Database.
The current approach i have with me is to open Database ( MS -Access ) , apply the desired SQL command, and read from OleDbDataReader, but the problem is due to heavy use, application seems to be slow down !
Another idea i have with me is, to once get all information in DataSet , and access it later , my question here is, can i apply all commands which i have been using to get data from original database ? i actually want to know is it really possible ?
What i think is DataSet works as a Virtual Database ? am i right ?
If someone can help, i will really be grateful. It will be pleased to have a detailed answer.
Regards
Yahya
muhammad.yahya@gmail.com
|
|
|
|
|
What dataset does it to make a local copy of some tables (You can make it all the database),
That is why it's called disconnected ,cuz it stores this copy in the ds and then it disconnects from the dataserver or file and then,after all the changes you make to the tables contained in the and then just make your local database copy (With changes) update the original by using the dataadapter class.
|
|
|
|
|
Hi,
I have the following problem:
I have a windows form called <customfunctions>.In the form <customfunctions> I have, among other controls, a textBox called <textboxfunction>, a comboBox called <comboboxuserfunctions> and 2 buttons called <btnsave> and <btnedit>.
In the second form, called "Save" when <btnsave> pressed and "Edit" when <btnedit> pressed, I have only a textBox called <textboxfuncname> and a button <btnok>.
Case 1: When I press <btnsave>
=============================
In the second form:
When pressing <btnok>, I want to take the text in the <textboxfunction> (this would be the function's formula) and the text in the <textboxfuncname> (this would be the name of the function) and add them to <comboboxuserfunctions>.
Case 2: When I press <btnedit>
==============================
In the second form:
When pressing <btnok>, I want to take the text in the <comboboxuserfunctions> put it in the <textboxfuncname>, where it can be changed.
When I pres <btnok> I want the <comboboxuserfunctions> to reflect the changes made, meaning that the funtion has a new name.
The big problem is that I don't know how to transfer data between forms without using IsMDIContainer Property. I don't use this property because I don't know how to make the MDIChild visible (to actually see every control on the MDIChild form).
Please help me !!! I'm in desperate search for help !
I've tried up to now all I could ever think of (obviously not enough) confused:
Cheers to all of you,
Adisor
|
|
|
|
|
This is nice. Have you actually read your own post and tried to make any sense of it? Go ahead, try it now. I'll wait...
Don't enclose anything in < and > brackets unless you want it to be treated as an HTML tag. The workaround is to check the little box under the message window that says "Do not treat <'s as HTML tags" before you click the Submit button.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|