Hi, cyberbiker. Actually writing a driver for any OS is not as simple as having some sample code for such. Windows works with the so called VxDs (VDDs under NT) or virtual device drivers. These are programs which operate in the ring 0 level of the OS which means they are allowed to do anything. User applications, on the other side, are restricted in doing a lot of things and one of these is the direct access to system hardware or peripherals. This is where the device drivers come into use. They are exploited as an interface for the user applications to call specific hardware or OS-specific functions. If you have written programs for DOS (where user programs and OS work in the same privileged CPU level), you should have pretty good knowledge of what a VxD can do - anything - interrupts, direct memory access, anything. That is why when writing a VxD you should be extremely careful because Windows cannot protect itself from poorly-written drivers and it can pretty easily just hang. Now something more specific: usually it is a good practice to write drivers in assembly or more rarely in C. It is inconvenient to write something low-level in a very high-level language. I think it's clear that you should very well understand the underlying hardware - in this case - your USB mouse. USB has a simple serial interface but actually a very complex communication protocol. It will be easier for you not to implement USB specific communication stuff but rather use Microsoft's drivers and using a high-level language to implement their USB interface. You can find the USB driver files by checking in Windows' device manager for the USB stuff. You should then try to find some documentation on the interface that specific driver provides for user apps but I am not sure if Microsoft publish things like these. Anyway - worth a try. I didn't say it's gonna be easy. Just easier. Otherwise, the VxD is like a dynamic library. The Win32 API provides functions which you can use to grant access to the VxD's services. Check DeviceIOControl API call. You have Win32 SDK Reference, don't you? If not - get MSDN. Also you'll need the Drivers Development Kit provided by Microsoft as well in their MSDN series. The DDK includes header files for C and assembly which you must use in your driver program in order to compile a working VxD. After writing the VxD you should probably make a user app to use it and configure it. And also I have seen USB-to-COM converter integrated circuits which you can use to translate between USB and common RS232 signals (one IC I've used is: PL2303 Prolific Design). They have accompanying drivers which provide you with a virtual COM port which is a whole lot easier to use than USB. I guess what I said is pretty general in nature but I hope it'll help in some way.
Best regards,
Ivan