Your joystick driver must include the standard DriverProc entry point function. This function handles the standard and joystick-specific messages sent by MMSYSTEM. DriverProc has the following syntax:
LRESULT WINAPI DriverProc(dwDriverID, hDriver, uMsg, lParam1, lParam2)
The uMsg, lParam1, and lParam2 parameters are used to send the message and associated data to the device driver. The lParam1 and lParam2 parameters are a LPARAM data type and their content is message dependent. The uMsg parameter is a UINT data type. For joystick messages, the hDriver parameter contains a handle to the device driver and the dwDriverID parameter contains the driver ID created by the device driver.
For more information on the DriverProc entry point and the system messages it handles see the description of installable device drivers in the Microsoft Windows Software Development Kit.