Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Beginning VB 6
|
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 Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 4th, 2005, 08:04 AM
Authorized User
 
Join Date: Feb 2005
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
 
Old August 4th, 2005, 08:35 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

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
 
Old August 4th, 2005, 08:40 AM
Authorized User
 
Join Date: Feb 2005
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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





Similar Threads
Thread Thread Starter Forum Replies Last Post
.net on Windows 98 sh.rajkumar C# 2005 1 October 23rd, 2006 03:53 AM
It wont Connect toMySQLChapter 3,Page 95-98, Alej PHP Databases 3 August 29th, 2006 11:37 PM
Font problem in Windows 98 soccers_guy10 VS.NET 2002/2003 0 January 10th, 2005 03:44 AM
Windows 98 OCX control issues vs Windows XP benoyraj VB How-To 0 May 5th, 2004 08:10 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.