Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Equivalent Commands
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00156528
Message ID:
00156660
Vues:
28
DJ,

The code you posted is all basically VFP compatible. There is a MS KB article Q191950 that shows how to use Agent from VFP. LoadCharacter() is a method though of a sub component. Here is some of the code from the KB article

oAgent = createobject("Agent.Control.1")
oAgent.connected = .t.

*-- Load a character from the character definition.
*-- Modify the path to point to where the character
*-- definition is installed.
oAgent.characters.load("Genie", ;
"c:\program files\microsoft agent\characters\genie.acs")

*-- Create the character object, the Genie in this example.
oGenie = oAgent.characters("Genie")
oGenie.Show
oGenie.Speak(ThisForm.Text1.Value)

The only thing from VB we don't have are named parameters. The arguments to a method must be enclosed in ( ) and passed in order. Optional parameters can be skipped with just a comma.

>In VB there is a Set command for objects. Once set you can then use that as an object reference. Let me give you an example:
>
>Set xl = CreateObject("Excel.Application")
>
>You can now use that as your object reference. Like:
>
>xl.Workbooks.Open("C:\Spreadsheets\Sales.xls")
>xl.ActiveWorkbook.ActiveSheet.Range("B2").Value
>
>I am looking for an equivelent in VFP. I can fake it by stuffing a variable and then using the macro substitution but this doesn't work in all cases, like this:
>
>Genie = LoadCharacter("Genie")
>
>Please note to fake it I must ust the double period, maybe someone could explain that one also.
>
>&Genie..Play("Move",100,200)
>&Genie..Speak("I don't know what I'm doing")
>
>The reason that I am asking is that the genie returns a handle and I can't seem to grab it and use it like the VB example shows.
>
>TIA
>
>DJ
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform