|
|
 |
| Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET). |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Beginning VB 6 section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|
 |

August 4th, 2005, 09:04 AM
|
|
Authorized User
|
|
Join Date: Feb 2005
Location: , , Netherlands.
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Getversion issue with Windows 95/98 ?
Hi all,
I made a piece of code which determines the OS of a computer, and also whether Windows Installer has been installed or not. Following to this, the program also checks the version of Windows Installer. If it is 2.0 or higher, the program does nothing. If not, it starts an executable.
The program works fine on WinXP, but when I try to run my program on Windows 95, it crashes when trying to determine the version of Windows Installer.
[my code]
Form1.Show
opsys = fOSName
'
If opsys = "Windows XP" Or opsys = "Windows 2000" Or opsys = "Windows 2000 NT" Then
MsgBox "Windows Installer 2.0 of higher installed..."
Exit Sub
End If
'
''''''''FIRST CHECK WINDOWS DIRECTORY FOR FASTER HANDLING''''''''''''''''''''''''
If Dir("C:\WINDOWS\System32\msiexec.exe") <> "" Then
version = Left(GetVersion("C:\WINDOWS\System32\msiexec.exe") , 1)
If version >= 2 Then
MsgBox "Windows Installer 2.0 or higher installed"
Exit Sub
Else
GoTo install
End If
Else
Path = fSearchFile("msiexec.exe", "C:")
'
If Path <> "" Then
version = Left(GetVersion(Path), 1)
MsgBox "Version: " & version
If version >= 2 Then MsgBox "Windows Installer 2.0 or higher installed"
Else
GoTo install
End If
End If
'
install:
If opsys = "Windows 95" Or opsys = "Windows 98" Or opsys = "Windows ME" Then
Shell "D:\WinInst for 95,98,ME.exe"
Else
Shell "D:\WinInst for NT 4.0 , 2000.exe"
End If
'
[end code]
Does anyone have an idea on why my code might not work (yes, I have all the API call properly coded in another module) on Win95 or Win98?
It seems to be only the checking of the fileversion which causes the culprit.
Any help will be much appreciated...
Max
|

August 4th, 2005, 09:35 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,000
Thanks: 5
Thanked 37 Times in 36 Posts
|
|
hi there..
what api are you using for getversion??
acording to api guide:
The GetVersion function returns the current version number of Windows and information about the operating system platform.
Declare Function GetVersion Lib "kernel32" Alias "GetVersion" () As Long
If the function succeeds, the return value is a DWORD value that contains the major and minor version numbers of Windows in the low order word, and information about the operating system platform in the high order word.
For all platforms, the low order word contains the version number of Windows. The low-order byte of this word specifies the major version number, in hexadecimal notation. The high-order byte specifies the minor version (revision) number, in hexadecimal notation.
To distinguish between operating system platforms, use the high order bit and the low order byte, as shown in the following table: Platform
High order bit
Low order byte (major version number)
Windows NT
zero
3 or 4
Windows 95
1
4
Win32s with Windows 3.1
1
3
For Windows NT and Win32s, the remaining bits in the high order word specify the build number.
For Windows 95 the remaining bits of the high order word are reserved.
------
i dont know why it works on other OS, but you should be using GetFileVersionInfo
The GetFileVersionInfo function returns version information about a specified file.
HTH
Gonzalo
|

August 4th, 2005, 09:40 AM
|
|
Authorized User
|
|
Join Date: Feb 2005
Location: , , Netherlands.
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi Gonzalo,
First of all, my excuses for not telling which API calls I am refering to.
However, I have been able to solve the problem just a few minutes ago. I think the issue lay in the Scripting.FileSystemObject...Now I am using an API call which doesn't give me any trouble when running it on Windows 95
But thanks for your support
Max
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |