Except for changing the x, y, width, and height values, as well as adding + 1 to part of it, I have changed nothing.
When I tried to compile it, I got the error message 56 23 [Error] cannot convert 'INPUT (*)[1] {aka tagINPUT (*)[1]}' to 'INPUT* {aka tagINPUT*}'for argument '1' to 'void MouseSetup(INPUT*)'
To remedy this, I made it just pass buffer instead of &buffer inside each main function, and everything seems to work now.
My only question is: Why was this stackoverflow post passing the address of the address of the buffer array, it seems like such an obvious error to miss? Is there a case where this would be valid C or C++ code?
Stuff like this happens to me to sometimes. You see a question posted and you have a functional set of code that does what the OP wants. But since what you have is meant to accomplish much more then what is asked for, you go through and chop out the extraneous parts that don't fit the OP's question so as not to confuse him with the unrelated bits. And since as programmers we are inherently lazy, we never bother to test compile the sample before posting it and you end up with the situation that you linked to at SO. Like you said it's an easy thing to spot for people who actually read the code, and if they aren't really reading it then they're a script kiddie so who cares that they can't figure it out.