I want to emulate a joystick using keypresses and/or mouse input. So other programs/games will think that user is using a joystick while he is using a mouse.
So the program will install kindof a driver for fake usb or fake an existing joystick.
There is an existing program called PPJoy which does the same thing but sadly its closed source and needs the user to install it standalone and do the configuration steps.
Found this: http://www.microsoft.com/whdc/archive/hidgame.mspx
but not able to make much sense out of it. Some high level pointers required so that I can then research on my own instead of blindly knocking all doors :)
edit: i am trying to control a third party program which supports only joystick
see my answer for a previous question that is really similar to yours.
Writing a windows driver for an emulated input device
Obviously it depends on what type of joystick input you are trying to emulate. Writing a custom driver is really something you want to avoid as much as you can. You may not need to do it at all.
Your best bet would be to modify the sample VHIDMINI - Sample for Virtual HID device from the Windows DDK. You could modify this sample driver to emulate a joystick HID device and then send out joystick HID reports from the driver.