Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Declare dll if it exists
Message
From
31/03/2009 17:10:59
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01392477
Message ID:
01392500
Views:
62
>>>I have an app that runs in winxp desktops and also terminal server. If running on terminal server it needs to "declare integer WTSQuerySessionInformation in Wtsapi32.dll". If the app is running on xp it needs to skip this as it won't exist. What is a good way to determine how to load this dll or not?
>>
>>Is FILE() function didn't work for you?
>>
>>IF FILE("Wtsapi32.dll")
>>   DECLARE ....
>>ENDIF
>>
>
>I don't think file() will find it in the windows system directory?

I don't know, maybe you do think so. If you do, you're right, it won't - file() is scoped to Fox's path, not the DOS path. But you can use Tracy's way, or write a loop
lcPath=getenv("path")
lcFile=""
for i=1 to getwordcount(lcpath, ",;")
   lcP1=getwordnum(lcPath, i, ",;")
   lcFile=forcepath("Wtsapi32.dll", lcP1)
   if file(lcFile)
      exit
   endif
endfor
return lcFile
Instead of this specific dll you can make pass any filename as a parameter, and if it's there you'll get the full path to it, or else "".

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform