p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > Visual Basic > VB 6 Visual Basic 6 > Beginning VB 6
I forgot my password Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 4th, 2005, 09:04 AM
Authorized User
Points: 251, Level: 5
Points: 251, Level: 5 Points: 251, Level: 5 Points: 251, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2005
Location: , , Netherlands.
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old August 4th, 2005, 09:35 AM
Friend of Wrox
Points: 6,570, Level: 34
Points: 6,570, Level: 34 Points: 6,570, Level: 34 Points: 6,570, Level: 34
Activity: 43%
Activity: 43% Activity: 43% Activity: 43%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,000
Thanks: 5
Thanked 37 Times in 36 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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #3 (permalink)  
Old August 4th, 2005, 09:40 AM
Authorized User
Points: 251, Level: 5
Points: 251, Level: 5 Points: 251, Level: 5 Points: 251, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2005
Location: , , Netherlands.
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
.net on Windows 98 sh.rajkumar C# 2005 1 October 23rd, 2006 04:53 AM
It wont Connect toMySQLChapter 3,Page 95-98, Alej PHP Databases 3 August 30th, 2006 12:37 AM
Font problem in Windows 98 soccers_guy10 VS.NET 2002/2003 0 January 10th, 2005 03:44 AM
How to use ASP 3.0 in windows 98. BurhanKhan ASP Forms 2 June 17th, 2004 07:47 PM
Windows 98 OCX control issues vs Windows XP benoyraj VB How-To 0 May 5th, 2004 09:10 AM



All times are GMT -4. The time now is 04:11 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc