Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
RELEASEing an EXE COM Server
Message
De
01/02/2012 02:46:20
 
 
À
31/01/2012 17:41:17
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Divers
Thread ID:
01534159
Message ID:
01534187
Vues:
60
Yes, that's exactly what I've already tried. On my machine I get an error: "OLE error code 0x80020006: Unknown name."

I think it has to do with the VFP7+ Session object hiding certain PEMs: http://msdn.microsoft.com/en-ca/magazine/cc302029.aspx

>Have tried adding...
>
>Procedure Destroy
>      DoDefault
>endproc
>
>
>to help expose it.
>
>>Suppose I have an EXE COM server, based on the Session object, defined as follows:
>>
>>DEFINE CLASS FLocker AS Session OLEPUBLIC
>>	* DataSession = 2 (Private Data Session) is the default for the Session class
>>	
>>	FUNCTION Init
>>		SET EXCLUSIVE OFF
>>		SET TABLEVALIDATE TO 0
>>	
>>	ENDFUNC
>>	
>>	FUNCTION TableLock ( tcTable AS String, tcAlias AS String ) AS VOID
>>		USE ( tcTable ) ALIAS ( tcAlias ) IN 0 SHARED NODATA NOUPDATE
>>		=FLOCK( tcAlias )
>>	
>>	ENDFUNC
>>	
>>	FUNCTION TableUnlock ( tcAlias AS String ) AS VOID
>>		UNLOCK IN ( tcAlias )
>>		USE IN ( tcAlias )
>>	
>>	ENDFUNC
>>	
>>ENDDEFINE
>>
I can invoke the COM server with something like
>>
>>loEXECOMServer = CREATEOBJECT( "MyEXECOMServerName.FLocker" )
>>
and the COM server is created properly, works fine, and duly appears as a separate process in Task Manager.
>>
>>To release the server when I'm finished with it, until now I've just been issuing
>>
>>RELEASE loEXECOMServer
>>
which seems to work - the process disappears from Task Manager. Is this "best practice" for RELEASEing COM servers?
>>
>>Somewhat related, apparently the Session object hides "intrinsic" properties and methods by default, so as not to pollute the .TLB file. So, with this class, even if you define a .Destroy method, you can't call it from the calling program e.g. loEXECOMServer.Destroy( ) throws a COM/OLE error. But, any specified .Destroy( ) code does run when the object is RELEASEd as above.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform