>>I have this idea that since VFP5 does not have a "SENDKEYS" function like all versions of VB5, it would be nice to have. Rather than fiddle around with the API using SendMessage etc. I thought of creating an OCX in VB5 with a PUBLIC Function to do this for me.
>>
>>The Fn has this code:
>>Public Function SendKeyz(title,keyz,wait)
>>' title - title of the app window
>>' keyz - keystrokes to send
>>' wait - see hlp on this call
>> APPActivate title
>> SendKeys keyz, wait
>>End Sub
>>
>>I tested it in VB5 and it worked fine even sending keystrokes to the Fox command window. Create as OCX and tried to add it to a VFP5.0a form. VFP CRASHED every time with an invalid page fault.
>>
>>OK I changed the Function to a Public Procedure.Now VFP did not crash and so I ran the form.
>>
>>The form had this in the click event of a button:
>>ThisForm.Olecontrol1.Sendkeyz("Calculator","1 & {+}", 1)
>>
>>I get OLE error every time - Invalid call to procedure/function.
>>
>>I changed the OCX to just accept the Window title and hard coded the keystrokes in the OCX. Compile and reload the form in VFP. Same Error.
>>
>>Of course I had in the init _vfp.AutoYield = .F. as well as the sys() fn.
>>
>>What am I doing wrong here?? Is the OCX wrong or is the call syntax wrong.
>>
>>Please help.
>>
>>BErnard
>
>
>You need to set SYS(2333)
If you see this line
>Of course I had in the init _vfp.AutoYield = .F. as well as the sys() fn.
The sys fn there is sys(2333).
Any other suggestions?