Had something like this last month, tied it down to the dynamic array.

Your line SetLength(FJoyDevice, Length(FJoyDevice) + 1); is definitely going to cause you problems.

First, (at least in D4) Length refers to the length of a string NOT an array.

Second finding the size of an array like this (I used Sizeof) simply returns the pointer size to the array.

The number of elements is given by the function High(arrayname), so to expand a dynamic array you would write

SetLength(FJoyDevice,High(FJoyDevice)+1);

Suggest you try this line and see if it solves your problem.

Hope it helps a little.