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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple Question: Copy Necessary Files Depending Upon OS

Status
Not open for further replies.

ntauzin

MIS
May 24, 2002
11
US
Hi-

I am trying to put together an application that only has to copy 5 files to the hard drive, and that's it. Two of the files are system files, and so if the OS is Win 9x/ME they need to go into c:\windows\system, and if it's Win NT/2000/XP they need to go into c:\winnt\system32.

Should be simple enough but can anyone help out with the way to make it the mnost efficient code possible? I am a little lost here.

I want to compile the commands into a simple, one-button executable file.

Thanks!!!
 
thats what the package and deployment wizard does. or you can find some free setup programs on the internet (inno setup being one).
 
Thanks for the suggestion! I downloaded the Inno Setup Compiler and it is extremely easy to setup!

Is there a way I can add some code in that will detect the OS? Otherwise I will have to distribute 2 exe's.
 
You might want to take a look at the GetVersionEx API call.

'-------------------------------------------
Public Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As Long
'-------------------------------------------
Public Type OSVERSIONINFO
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128
End Type
'-------------------------------------------Public Function GetWinVersion() As String

Dim OSInfo As OSVERSIONINFO, PId As String
Dim Ret As Long

OSInfo.dwOSVersionInfoSize = Len(OSInfo)
Ret = GetVersionEx(OSInfo)

If Ret = 0 Then
MsgBox "Error Getting Version Information"
Else
Select Case OSInfo.dwPlatformId
Case 0
PId = "Windows 32s "
Case 1
PId = "Windows 95/98"
Case 2
PId = "Windows NT "
End Select

MsgBox "OS: " + PId & vbCrLf & _
"Win version:" + Str$(OSInfo.dwMajorVersion) + "." + LTrim(Str(OSInfo.dwMinorVersion)) & vbCrLf & _
"Build: " + Str(OSInfo.dwBuildNumber)
End If

End Function Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top