views:

112

answers:

2

Using a Visual FoxPro 9 executable file, (EXE), I need to be able to place data into the system keyboard buffer which is then to be picked up by another program, (non-FoxPro). I've already tried using the KEYBOARD command, however, that only seems to work with fields and controls within the FoxPro application! Does anyone have any ideas on how this can be accomplished?

A: 

Do you mean to copy to the clipboard? If so, here are two ways. The first example copies a string to the clipboard. The second example copies a table/cursor to the clipboard.

_cliptext = "test"

_vfp.DataToClip(SELECT(ALIAS()), RECCOUNT() + 1, 3)

Tom Brothers
+1  A: 

You'll need to call into the Win32 API - keybd_event is probably the call you want as SendInput uses structs, which are a pain in VFP. There's sample code here.

Stuart Dunkeld
Thanks Stuart, I had been considering the API option and was hoping that I wouldn't have to go down this route. As you said, this could be a pain.
LionelCP