Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
COM+ server DLL compile error.
Message
From
14/10/2004 16:44:11
 
 
To
14/10/2004 16:36:19
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00951545
Message ID:
00951546
Views:
11
Hi Jim,

Try these articles:
http://msdn.microsoft.com/library/en-us/dnfoxtk01/html/ft01e1.asp
http://msdn.microsoft.com/library/en-us/dnfoxtk01/html/ft01f20.asp
http://msdn.microsoft.com/library/en-us/dnfoxtk01/html/ft01g13.asp
http://msdn.microsoft.com/library/en-us/dnfoxgen/html/mtsvfp.asp


>VFP 8 SP1. Trying to compile a multithread DLL com server (XP Pro, SP2). This is in the way of an experiment in making a COM+ server component to offload some work from the client to be performed at the server.
>
>Without the MTS stuff, I got the component to work, as far as calling it from another machine. It will return results, but it won't die. I then found this reference go here on how to make them work, from Craig's site.
>
>My understanding is that you need the MTS code to tell the component you are finished with it. Without it, I was left with DLLHOST running on my test server with no way to kill it.
>
>This command, taken from an article on COM+ generates a compile-time error
>
>'command contains unrecognizable phrase/keyword' error
>
>
>    loMtx = CREATEOBJECT(“MTXAS.APPSERVER.1”)
>
>
>Perhaps a skeleton of a COM+ server object would be helpful as far as the basics needed in order to get them to work correctly. All help is appreciated. <g>
>
>entire program:
>
>**************************************************
>*-- Class:        myserv (c:\development\comserv\classes\myserv.vcx)
>*-- ParentClass:  custom
>*-- BaseClass:    custom
>*-- Time Stamp:   10/11/04 04:35:01 PM
>*
>Define Class myserv As custom OlePublic
>
>
>	Name = "myserv"
>	classlogic = .F.
>	Dimension classlist[10]
>
>
>	Procedure Init
>&& test
>	If !Used("statemnt")
>		Use l:\Shared\statemnt In 0 Order wcode Shared
>	Endif
>	For x = 1 To 10
>		This.classlist[x] = ' '
>	Endfor
>	This.classlogic = 'S'
>	Endproc
>
>
>	Procedure checkrec
>&& checkrec
>	Lparameters cClass
>	Local lanswer, i, cPattern
>
>	Set Exact On
>
>	lanswer = .T.
>	If This.classlogic = 'I' && Ignore classes
>		Return lanswer
>	Endif
>
>	If This.classlogic = 'D' && Skip 'Deleted' classes all begin with 'D'
>		If (Left(cClass,1) = 'D')
>			lanswer = .F.
>			Return lanswer
>		Endif
>	Endif
>
>	If This.classlogic = 'S' && Skip listed classes
>		If (Ascan(This.classlist,cClass) > 0) And !Empty(cClass)
>			lanswer = .F.
>			Return lanswer
>		Endif
>		For i = 1 To 10			&& test for wildcard chars in skipped class codes
>			cPattern = Alltrim(Upper(This.classlist[i]))
>			If (At('*',cPattern) > 0)		&& wildcard
>				If Like(cPattern,cClass)
>					lanswer = .F.
>					Return lanswer
>				Endif
>			Endif
>			If (At('?',cPattern) > 0)		&& wildcard single char
>				If Like(cPattern,cClass)
>					lanswer = .F.
>					Return lanswer
>				Endif
>			Endif
>		Endfor
>	Endif
>
>	If This.classlogic = 'P' && Print only listed classes
>		lanswer = .F.
>		If (Ascan(This.classlist,cClass) > 0) And !Empty(cClass)
>			lanswer = .T.
>			Return lanswer
>		Endif
>		For i = 1 To 10			&& test for wildcard chars in include-only class codes
>			cPattern = Alltrim(Upper(This.classlist[i]))
>			If (At('*',cPattern) > 0)		&& wildcard
>				If Like(cPattern,cClass)
>					lanswer = .T.
>					Return lanswer
>				Endif
>			Endif
>			If (At('?',cPattern) > 0)		&& wildcard single char
>				If Like(cPattern,cClass)
>					lanswer = .T.
>					Return lanswer
>				Endif
>			Endif
>		Endfor
>
>	Endif
>
>
>	Return lanswer
>	Endproc
>
>
>*-- eia match
>	Procedure match
>	&& will be called by client to get records meeting the correct criteria
>	Lparameters cCollector, cAcct
>	Local lcReturn,loMtx, loContext
>    loMtx = CREATEOBJECT(“MTXAS.APPSERVER.1”) && <<<<<<<<<<< OFFENDING LINE HERE >>>>>>>>>>>>>>>>
>
>    * Create a reference to the Context object
>    loContext = loMtx.GetObjectContext()
>
>	lcReturn = ""
>	Select * From statemnt ;
>		WHERE (acct == cAcct);
>		AND (collector == cCollector)
>
>	If Empty( Alias() ) Or Reccount() = 0
>* Nothing to do
>	Else
>		Cursortoxml( Alias(), "lcReturn", 1, 1 + 8, 0, "1" )
>	Endif
>    * Commit the transaction if there is one
>    * and tell MTS that we’re done using the component
>    loContext.SetComplete()
>
>	Return lcReturn
>
>	Endproc
>
>PROCEDURE error
>Local lcReturn,loMtx, loContext
>    loMtx = CREATEOBJECT(“MTXAS.APPSERVER.1”)
>    * Create a reference to the Context object
>    loContext = loMtx.GetObjectContext()
>    *
>    * and tell MTS that we’re done using the component
>    loContext.SetAbort()
>	return
>endproc
>Enddefine
>*
>*-- EndDefine: myserv
>**************************************************
>
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform