Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Name of variable associated with an object
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Title:
Name of variable associated with an object
Miscellaneous
Thread ID:
00447637
Message ID:
00447637
Views:
81
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. From there, I can populate a Locator structure with information about the variable itself (e.g. data type = Object and so forth). But it is not readily apparent how or if I can go the other way. Is there any cyclical reference to the variable itself (perhaps associated with the reference count)?

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.

Cheers!
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Next
Reply
Map
View

Click here to load this message in the networking platform