When you work with the joystick, probably the hardest part is getting it set up. There can be various joysticks plugged in, or none at all; you can’t use a predefined GUID to identify the joystick like you did before. Now you need to get the GUID of the joysticks from DirectInput.
Before checking how you do this, take a look at the mrJoystick class definition:
Which looks very much like the mouse class, except this time you use only one state structure, DIJOYSTATE2 since you won’t be using buffered data, and there is a