I dont know how to phrase my question because this area of programming is new to me.

My problem is this. I will have a low level mouse hook capturing mouse events. This data capture needs to be able to run for a reasonable length of indefinate time. What is the best method to record these events Directly into a file as each event occurs Into some kind of memory structure

The recording of data, should have next to 0 impact on system performance, and should not make the hard drive access light flash constantly. Any help would be awesome!

Re: Visual C# Express Edition Effecient data management


Directly into file as each event occurs is the best for small program memory size, however it will be file IO which is costly and will cause some impact on system performance and cause hard drive access light.

An interval would be best where you build up a buffer of event, write the buffer at every X number of events, then clear the buffer and wait for more events.

Storing it fully in the program or memory will soon eat up a lot of memory.

Mouse events are horribly numerous, especially low level, as a move from point X to point Y by the user can be tens of events.

The only way to have next to 0 impact on the system performance (in any way) is to do everything in registers and never save data. You'll have an impact on system performance, but you can minimize it.

Re: Visual C# Express Edition Effecient data management


Didnt realize you had responded to my post. Thank you. With that said. I figured file i/o would be the best method to ensure the system remains stable under an extended period of time in which the hook was active. I also thought about the buffereing technique.. ...

Over an 8 hour period, the number of mouse events would indeed be rediculous(not event counting key events, because I havent decided if I will implement this due to obvious security and privecy reasons)

Is there any technique I could use to keep the data compact in memory, or compress it when writing to a file I do not have much experience in simple stream file i/o. Is this how I should write my data to a file Or should I use ADO Just some thoughts I threw up in the air as brainstorming. I'll do more research tonight.

In conclusion. I must be able to save the data and retrieve it. There should be very little impact on the overall system performance. I'll do research tonight. Any further ideas/suggestions would be much appreciated.

Re: Visual C# Express Edition Effecient data management

Figo Fei - MSFT

Hi, Traps

You can check the System.IO namespace, and for compression check System.IO.Compression Namespace .


Re: Visual C# Express Edition Effecient data management


Thank you kindly. I will look into that if I can ever get past my current problem.