Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DLL Start path
Message
From
11/05/2006 12:06:23
 
 
To
10/05/2006 20:06:13
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Miscellaneous
Thread ID:
01120572
Message ID:
01121014
Views:
22
>>Is there a good way to soft code the path to the data that will be read by a COM DLL? I have tried several variations of SYS(2004) and HOME() all to no avail. My latest attempt was:
>>
>>
>>this.cDataPath = sys(2004) + "data\"
>>set path to (this.cDataPath)
>>set default to (this.cDataPath)
>>
>>
>>This worked OK on the first call to the server but fails on subsequent calls with an error message to the effect that the dbf does not exist. At the same time it seems to be looking for the file in the windows system directory rather than the location specified. This second call to the COM server is based on a freshly loaded instance of the COM object so I can't figure out why or how the path is getting screwed up. Everything works fine if I hard code the location but then I have to maintain different versions for the development PC and the ultimate web server.
>>
>>Any insights on whats going on will be appreciated.
>>
>>- Don
>
>This is what I use to cover all the bases:
>
>
>If Application.StartMode = 0 Then
>	If Type("Application.ActiveProject") = [O] Then
>		Application.DefaultFilePath = Application.ActiveProject.HomeDir
>	Else
>		Application.DefaultFilePath = Justpath(Substr(Sys(16),At([\],Sys(16))-Iif(At([\\],Sys(16))=0,2,1)))
>	Endif
>Else
>	Application.DefaultFilePath = Justpath(Application.ServerName)
>Endif
>
>
>Carlos

THanks Carlos
For some reason unknown to me I was not able to get Justpath(Application.ServerName)to work reliably for me. Sometimes it would return the proper value and other times it would not. Probably somethig quirky in my code. Sergey's solution seems to work OK, at least for the moment.
Previous
Reply
Map
View

Click here to load this message in the networking platform