Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Name of variable associated with an object
Message
 
 
À
30/11/2000 16:05:17
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00447637
Message ID:
00447697
Vues:
19
>>Hi All,
>>Does anyone have a utility that will give me the name of a variable associated with an object?
>>
>>Here is what I know (the little there is):
>>When an object is assigned to a variable, the internal reference counter of that object is incremented. When that variable is released (in some fashion), the reference counter is decremented.
>>
>>Looking at the VFP API functions, it looks like given a variable name, I can get it position in the internal Memory Index.
>
>Really? How? You mean with the LCK?

Yes. The _NameTableIndex() function will return the relative position in VFP's name table of the variable with the name you pass it. From there you can get information about that variable using the _FindVar function. It populates a Locator structure with information about that variable.

>
>>The reason for this is because of an error handler I am creating. The syntax still exists to RETURN TO < ProcedureName >. If an error occurs I want to totally exit the object and return to whatever called it. What I am doing is at the beginning of a method call, I store the name of the procedure that called it using Program(Program(-1)-1). If an object called it, it is stored in the form of ClassName.MethodName. An error occurs in the RETURN TO line because it doesn't want that format. It wants VariableName.MethodName.
>>
>>I appreciate any feedback but I will say now I already have a workaround. During object instantiation, I pass in the name of the variable that it is being assigned to and use it in my return statement. I was hoping to avoid this and by making the object smarter.
>
>SYS(1272)?

Actually, the reason behind why I needed this has been superceded. I had a syntax error and didn't know it.

RETURN TO &lcprg && does not work
RETURN TO lcprg && does work

I would still like to know if there is a way to do this just for acedemic reasons at this point.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform