Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Returning a collection from a COM
Message
 
 
To
10/08/2004 15:52:24
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00932180
Message ID:
00932556
Views:
21
I created a test COM server with following simple class and compile it into DLL and EXE (VFP8SP1). I also tested with oTable been a property of the class and local variable. A collection was returned properly in both cases.
DEFINE Class pm As session OlePublic
	oTables = Null
	PROCEDURE getListeTables ()
		*LOCAL oTables AS Collection
		oTables = CREATEOBJECT("Collection")
		FOR i=1 TO ADIR(laList, "h:\temp\*.DBF")
			oTables.Add(laList[i,1])
		ENDFOR
		RETURN oTables
	ENDPROC	
ENDDEFINE
...
o = CREATEOBJECT("mydll.pm")
oTables = o.getListeTables()
? oTables.Count
FOR EACH lcTable IN oTables   && Crash here
  ? (lcTable)
ENDFOR
>I have a method in my EXE COM that return a collection object. The call works well, but VFP crash when I try to access the collection in a FOR EACH loop.
loTables = loBuz.getListeTables (tcRepPrinc)   && Return an object
>	
>FOR EACH lcTable IN loTables   && Crash here
>   THISFORM.lstTablesDisp.AddItem (lcTable)
>ENDFOR
Any ideas?
>
>Update: This code also make VFP crash (C5 error):
FOR I = 1 TO loTables.Count
>   THISFORM.lstTablesDisp.AddItem (loTables.Item (I))
>ENDFOR
TIA
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform