Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
RELEASEing an EXE COM Server
Message
De
31/01/2012 17:41:17
 
 
À
31/01/2012 16:03:48
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:
01534169
Vues:
69
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.
Greg Reichert
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform