I've figured out how to set the mouse pointer X and Y positions with the API call SetCursorPos, but how can I generate a left mouse click? I tried this:

SendMessage 0, 513, 0, 0

(Where 513 = WM_LBUTTONDOWN)

But this had no effect.

Any ideas anyone? thanks

Nick