Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Application Setup 2

Status
Not open for further replies.

ejhemler

Programmer
Aug 30, 2002
68
US
I have an application that I have running on a server. Before this application can be run on a user's PC, I need to copy files from the server to their hard drive for the app. to work. These files are mainly just .dbf's to direct that hold path's to the server, but I also need to copy over the .dll's to the windows/system folder for foxpro to be able to run. Some user's have windows 2000 and some have 98 so the path's are different for where the .dll's need to be stored. is there a way in foxpro to tell what version of windows is being run on a certain machine, even if the program is run from a server?

Thanks,
Erik
 
The OS() function returns a different value. I don't think it's as clean as Rick's suggestion, but you can give it a shot to see if it fits your needs.

As for the DLL's. They are usually copied in the local startup directory or the systems directory (more common). I looked at the FAQs, but did not see one for determining the system directory. I have some code I use that I am willing to send you. I wrote it several years ago (early VFP) and I took it from a VB program and converted the syntax. It works great, but it has a lot of lines of code. I have seen others around with only a few lines of code.

Send me an e-mail if you would like that code. You can use it to determine the system directory and copy the files into it. Then you will not need to concern yourself with the OS version.


My email can be obtained from my web.


Jim Osieczonek
Delta Business Group, LLC
 
Try this. It will work on systems that have Windows Scripting Host installed:

ofs = CreateObject("Scripting.FileSystemObject")
cSysFolder = ofs.GetSpecialFolder(1) &&... 1 = System path
STORE cSysFolder.ShortPath TO cSystemDir
ofs = .NULL.
RELEASE ofs
?cSystemDir



-Dave S.-
[cheers]
Even more Fox stuff at:
 
It turns out the API was not that much code.

Here it is. You can use it thru the scripting object as DSummZZZ suggested or as an API Call.

********************************************************************
* Windows API Call to determine the users system directroy
Function GetSystemDir
Local lcWinSysDir, lcWinDir, lnRetLen

* following dll gets our windows directory.
* declare Window API function for window system dir.
DECLARE LONG GetSystemDirectory IN win32api STRING lpBuffer, LONG nSize

* declare Window API function for windows dir.
DECLARE LONG GetWindowsDirectory IN win32api STRING lpBuffer, LONG nSize

m.lcWinSysDir = space(255)
m.lcWinDir = space(255)

* get the windows system directory
lnRetLen = GetSystemDirectory(@lcWinSysDir,LEN(m.lcWinSysDir))
lcWinSysDir = LEFT(m.lcWinSysDir,m.lnRetLen)

* get the windows directory
* lnRetLen = GetSystemDirectory(@lcWinDir,LEN(m.lcWinDir))
* lcWinDir = LEFT(m.lcWinDir,m.lnRetLen)

Return lcWinSysDir


Jim Osieczonek
Delta Business Group, LLC
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top