[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 211
  • Last Modified:

Run app with a specific version.

How can i make my app run with a specific version of system?

Suppose the user is under Linux or Windows 2000 and i want
my app to run only with Windows xp home or professional.
Other wise my app will close.

Another example is this...
I want my app to run only with the specify version on the other program
If the other program is not the version specify in my app, Then Exit Sub.
  • 4
  • 3
1 Solution
You cannot even make a VB executable for linux. So you dont have to worry about that. What you can do though is verify that the computer is Windows XP.

DazmAuthor Commented:

BrianGEFF719: You cannot even make a VB executable for linux.
BrianGEFF719: So you dont have to worry about that.

I did not say that my app was for Linux.
What i tried to say is that, what if the user try my app in a computer with Linux or
other operate system that is not Win98, Me, xp, 2000 etc., Thats what i meant.

I have seen many programs that when they do not find the right version
of the other program, they continue to close itself if nothing was found.

BrianGEFF719: What you can do though is verify that the computer is Windows XP.

I have done this before, but i thought there was a better way to do it.
If Text1 Not "Windows XP" Then Exit Sub

I find this code long time ago in VB-Helper.com
With this code i can generate something close of what i want, but not what i really need.

Option Explicit

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

Private Const VER_PLATFORM_WIN32s = 0
Private Const VER_PLATFORM_WIN32_NT = 2

' Return the Windows version.
Public Function WindowsVersion() As String
Dim txt As String

info.dwOSVersionInfoSize = Len(info)
GetVersionEx info

Select Case info.dwPlatformId
txt = "Windows "
If info.dwMajorVersion = 5 Then
txt = "Windows 2000 "
ElseIf info.dwMajorVersion < 4 Or _
(info.dwMajorVersion = 4 And _
info.dwMinorVersion = 0) _
txt = "Windows95 "
txt = "Windows98 "
End If
txt = "WindowsNT "
End Select

txt = txt & Format$(info.dwMajorVersion) & _
"." & Format$(info.dwMinorVersion) & _
vbCrLf & "Build " & Format$(info.dwBuildNumber)
WindowsVersion = txt
End Function

Why is that not what you need?

If WindowsVersion <> "WindowsXP" Then
 Msgbox "You are not using the right version of windows!",16,"Error"
End if

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

DazmAuthor Commented:

Ok, let me explain a bit more.

First this code doesn't work...

> If WindowsVersion <> "WindowsXP" Then
> MsgBox "You are not using the right version of windows!", 16, "Error"
> End
> End If

I am with Windows XP and I still get the popup error message.

Here is how i was doing it before...

> If Text1 Not "Windows XP" Then Exit Sub

This one works very well for me, but not yours.
I do this with a Textbox, Label Text, or the name "Windows XP"

But anyways i already know this code, is the one i show you before
But like i said it, for me this is not a good method on how to do it.

It is not about make the program unload, hide, or close
just because the name of => "Windows XP" was not find.

The point of my project is to check not just the name
But the version of the assigning program to be detected.

For example:
I test my app in three different computer with windows xp OS
And this is the result... my app fail on one of the computers,
In one of the computers my app was reading => "WindowsNT" not "Windows XP"
The three computers had windows xp accept for one with Home edition, but still
Windows xp and i don't think it was because of the home edition version of windows.

So i was trying to avoid my app with all those differences in version of windows.
DazmAuthor Commented:

Sorry i took so long to reply to you, But i was not home : )

Yeah this looks like a good example...
But still have a little error reading windows.

=> Is Windows NT4 Plus ?.......True    Sorry but this is not true
=> Is Windows NT4 Server ?...True    Sorry but this is not true
=> Is Windows 2000 Plus ?......True    Sorry but this is not true

I think the rest is ok.

Is Windows XP ?................True
Is Windows Plus ?..............True
Is Windows XP Pro ?..........True

But after all, I wonder if i can pull the right information from this code to make mine code work.
DazmAuthor Commented:

Could you provide me with some example on how to make my
project work without having to use the example that you showed to me?

Thank you

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now