Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Configuration file and dll's
Message
De
04/08/2005 10:21:29
 
 
À
04/08/2005 08:06:15
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01037871
Message ID:
01038509
Vues:
18
Great to hear you found it helpful!

I apologize for leaving out the #define CRLF chr(13)+chr(10) line.

I pulled the method from a larger project and neglected to add it back to the method code.

>Thank you so much for GetInfo. After I defined *CRLF* the function performed flawlessly. I have placed it in every vfp dll I created. I have also created a web form called GetInfo.aspx and have placed it in all of my asp.net projects. Life is so much easier when you have such a great starting point. And.... thanx for the info about config.fpw when associated with dll's. GetInfo indicates that I set that up correctly on my mtdll. It is also great to see that the dll is running under com+.
>
>Regards,
>Dr. G. (Neil)
>
>
>>Yep, you can add the config.fpw to your project and mark it as included to have it built into the DLL. Otherwise it won't be read.
>>
>>I would suggest looking at sys(2023) if you are wondering where the temp files are going. Sys(0) can also be helpful as it returns the username (the format is machinename # username), so you can verify it is running under the account you think.
>>
>>tmpfiles= in the config file can be used to force a specific temp directory.
>>
>>Here is a function you can add to a COM server to return some diagnostic information from the server. Add it, then rebuild the server, and call with object.getinfo(). Pass a .T. to include BR (in anglebrackets) rather than CR+LF in case you are trying to output to an html page.
>>
>>I hope this helpsl!
>>
>>
>>FUNCTION GetInfo(tlUseBR as Logical) as string
>>
>>	local lcText, lcConfigText, oErr as Exception, ;
>>	lIsInMTS, oContext, cErr, oMTX, lcCommandLine, ;
>>	laServerVers[1], laServerInfo[1], lcServerType
>>
>>	cErr = ""
>>	lcText = ""
>>	lcServerType = ""	
>>
>>	* Determine startmode
>>	do case
>>		case _vfp.StartMode=0
>>		lcServerType='VFP IDE'
>>		case _vfp.StartMode=1
>>		lcServerType='VFP Automation Server'
>>		case _vfp.StartMode=2
>>		lcServerType='Out of Proc EXE'
>>		case _vfp.StartMode=3
>>		lcServerType='InProc DLL'
>>		case _vfp.StartMode=5
>>		lcServerType='InProc MTDLL'
>>	endcase
>>
>>	* Find out whether in COM+/MTS
>>	oContext = NULL
>>	try
>>	    oMTX = CREATEOBJECT("MTXAS.APPSERVER.1")
>>	    * returns NULL if not in COM+ or MTS
>>	    oContext = oMTX.GetObjectContext()
>>	catch to oErr
>>		cErr = oErr.Message
>>	finally
>>		lIsInMTS = !IsNull(oContext)
>>		release oMTX, oContext
>>	endtry
>>
>>	* Do we have a config file? (works in VFP9 only)
>>	lcConfigText = ""
>>
>>	if !empty(Sys(2019,2))
>>		lcConfigText= CRLF +"* Config File Contents:" ;
>>			+ CRLF + FileToStr(Sys(2019,2)) + CRLF + ;
>>			"* End of config file"+ CRLF 	
>>	endif
>>
>>	* Get Command Line
>>	DECLARE INTEGER GetCommandLine IN kernel32
>>	
>>	lcCommandLine = Sys(2600,GetCommandLine(),255)
>>
>>	clear dlls GetCommandLine
>>	
>>	* Drop trailing nulls
>>	lcCommandLine = Substr(lcCommandLine, 1, At(Chr(0), lcCommandLine,1)-1)
>>
>>	* Get version info for server:
>>	=AGetFileVersion(laServerVers,_vfp.ServerName)
>>	
>>	=ADir(laServerInfo,_vfp.ServerName)
>>	
>>* get remainder of settings, output them
>>
>>TEXT to lcText noshow textmerge
>>Date/time of run:   <<Datetime()>>
>>ServerName:         <<_vfp.servername>>
>>ServerVersion:      <<Iif(Type('laServerVers[4]')='U','None',laServerVers[4])>>
>>ServerDateTime:     <<Dtoc(laServerInfo[1,3])+ ' ' + laServerInfo[1,4]>>
>>DefaultDir:         <<_vfp.DefaultFilePath>>
>>CommandLine:        <<lcCommandLine>>
>>Is In COM+:         <<Iif(Empty(cErr),Iif(lIsInMTS,"Yes","No"),cErr)>>
>>ProcessID:          <<_vfp.ProcessID>>
>>ThreadID:           <<_vfp.ThreadID>>
>>RuntimeDLL:         <<_vfp.FullName>>
>>VFP Version:        <<Version()>>
>>StartMode:          <<lcServerType>>
>>MachineName:        <<GetWordNum(Sys(0),1)>>
>>UserName:           <<GetWordNum(Sys(0),3)>>
>>
>>SET RESOURCE is:    <<Set("Resource")>>
>>Resource file is:   <<Iif(!Empty(sys(2005)),sys(2005),"None")>>
>>Config File is:     <<Iif(!Empty(Sys(2019,2)),Sys(2019,2),"None")>>
>><<lcConfigText>>
>>VFP SET PATH:       <<Set("Path")>>
>>VFP Temp Path:      <<Sys(2023)>>
>>
>>OS Path:            <<GetEnv("Path")>>
>>OS TEMP Path:       <<GetEnv("temp")>>
>>OS TMP Path:        <<GetEnv("tmp")>>
>>
>>SET SYSFORMATS:     <<set('sysformats')>>
>>SET CENTURY:        <<set('Century')>>
>>SET DATE:           <<set('Date')>>
>>SET DECIMALS:       <<set('decimals')>>
>>SET HOURS:          <<set('hours')>>
>>SET MARK:           <<set('mark')>>
>>SET POINT:          <<set('point')>>
>>SET SEPARATOR:      <<set('separator')>>
>>SET ENGINEBEHAVIOR: <<set('enginebehavior')>>
>>SET REFRESH 1:      <<set('refresh')>>
>>SET REFRESH 2:      <<set('refresh',1)>>
>>
>>Foreground 3050:   <<Transform(val(sys(3050,1)),'@R 999,999,999,999')>>
>>Background 3050:   <<Transform(val(sys(3050,2)),'@R 999,999,999,999')>>
>>endtext
>>	return Iif(tlUseBR,Strtran(lcText, Chr(13)+Chr(10), '<BR>'),lcText)
>> ENDFUNC
>>
>>
>>>Hi,
>>>
>>>The VFP help file says:
>>>For .exe and .dll file servers, VFP supports only those configuration files bound inside the server.
>>>
>>>Can someone please tell me how to do it. Does that mean that I create a file called config.fpw and just include it as one of my project files?
>>>
>>>Actually this is what I would like to accomplish and I don't even know if I even need a configuration file. I would like to forcce my dll to use a specific directory on my web server for temp file creation. I am allowing an asp.net application to run with an impersonated user. My dll is the component of a COM+ application on the same server that runs under the same impersonated user. The resultant cursor of an SQL statement (that contains the readwrite keyword) writes to the physical disk (as per the vfp help file). In the windows 2000 os it is not a problem. In the windows xp os I sometimes get a security priv's issue. I am not certain where the temp file from as a resultant sql query is written to.
>>>
>>>
>>>
>>>Regards,
>>>Neil
Jim Saunders
Microsoft
This posting is provided “AS IS”, with no warranties, and confers no rights.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform