Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using an OCX created in VBCCEIN
Message
De
06/08/1998 18:59:11
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Titre:
Using an OCX created in VBCCEIN
Divers
Thread ID:
00124638
Message ID:
00124638
Vues:
47
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform