Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Pass ADO recordset to VFP dll
Message
 
 
To
07/08/2002 17:41:40
Mike Yearwood
Toronto, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00686572
Message ID:
00687527
Views:
53
Hi Mike,
Going to DevCon? If so, see you there! If not, maybe some other time.

Pemstatus() works on COM object properties that have been cached by VFP.
loADO = createobject('ADODB.RecordSet')
? pemstatus(loADO,'CursorType',5) && returns .F.
? loADO.CursorType
? pemstatus(loADO,'CursorType',5) && returns .T.
? pemstatus(loADO,'CURSORTYPE',5) && also returns .T.
The access of the property causes VFP to load the property into cache. Once this is done, the native VFP functions can access them.

The debugger is different. Prior to VFP 7, the debuuger was only able to access PEMs that had previously been accessed/cached. VFP 7's debugger uses the type library to list all the properties. There is also the added benefit that once you expand the object in the debugger, all the properties are cached so Pemstatus() works for all of them.

Regards.

>Hi Doug
>
>How've you been? How's the family?
>
>I'm sorry to do this, but I'll have to disagree with you for the first time. (I only dare since I have reproducible evidence <g>)
>
>I refused to believe PEMSTATUS cannot do it. This is the age of interoperability! The Object Browser can get detailed information from objects that I haven't instantiated. It would be very good for PEMSTATUS to get information from the object. The help on PEMSTATUS says it works on Objects. It doesn't indicate any restrictions. So I continued to try.
>
>I created a custom object. loCus = CreateObject("Custom"). I could see its properties in the property sheet. PEMSTATUS(loCus,"ClassLibrary",5) works.
>
>I created an empty ADO recordset in a variable. loADO = CreateObject("ADODB.RecordSet"). I could see its properties in the debugger. They are listed in mixed case. PEMSTATUS(loADO,"CursorType",5) does not work. On a hunch I tried PEMSTATUS(loADO,"CURSORTYPE",5) and it WORKED!?!?!?!
>
>The fact that PEMSTATUS is case sensitive with ADO (possibly COM?) objects is not documented anywhere that I checked (Wiki/Hacker's guide/UT)
>
>Another problem!
>
>I then passed the object into the DLL as a parameter by reference, where it was successfully manipulated. I could fire the ADO MoveFirst etc, methods. When I looked at the variable holding the RS in the debugger post DLL, it said "Object", but nonoe of the original properties were visible.
>
>That doesn't seem like a desirable feature either ;).
>
>>Hi Mike.
>>
>>>Pemstatus doesn't work. That's awful!
>>
>>Actually, I think it makes sense -- an ADO RecordSet is not a VFP object, so I can't see why PEMSTATUS() would work on it. You can use PEMSTATUS() on an ActiveX control in VFP because the control is really hosted in a VFP container. However, that isn't the case with a COM object.
>>
>>Doug
Larry Miller
MCSD
LWMiller3@verizon.net

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

Click here to load this message in the networking platform