Jump to content

Recommended Posts

Posted

Hey Guys,

I want to make an application (in VB.net or c#) which will run only on a Server 2003 box, does anyone know of a way to do this?

Thanks,


Posted
The GetVersionEx function obtains extended information about the version of the operating system that is currently running.

BOOL GetVersionEx(

LPOSVERSIONINFO lpVersionInformation // pointer to version information structure

);

Parameters

lpVersionInformation

Pointer to an OSVERSIONINFO data structure that the function fills with operating system version information.

Before calling the GetVersionEx function, set the dwOSVersionInfoSize member of the OSVERSIONINFO data structure to sizeof(OSVERSIONINFO).

Return Values

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError. The function fails if you specify an invalid value for the dwOSVersionInfoSize member of the OSVERSIONINFO structure.

Remarks

The GetVersionEx function supersedes the GetVersion function and is the preferred method for obtaining operating system version number information. New applications should use the GetVersionEx function rather than the GetVersion function.

There you go.
Posted

hey guys cheers for the help on this, still not sure what direction to take, i was recently pointed at this piece of code which works fine

Public Function OS_Version() As String

Dim osInfo As OperatingSystem
Dim sAns As String

osInfo = System.Environment.OSVersion

With osInfo
Select Case .Platform
Case .Platform.Win32Windows
Select Case (.Version.Minor)
Case 0
sAns = "Windows 95"
Case 10
If .Version.Revision.ToString() = "2222A" Then
sAns = "Windows 98 Second Edition"
Else
sAns = "Windows 98"
End If
Case 90
sAns = "Windows Me"
End Select
Case .Platform.Win32NT
Select Case (.Version.Major)
Case 3
sAns = "Windows NT 3.51"
Case 4
sAns = "Windows NT 4.0"
Case 5
If .Version.Minor = 0 Then
sAns = "Windows 2000"
ElseIf .Version.Minor = 1 Then
sAns = "Windows XP"
ElseIf .Version.Minor = 2 Then
sAns = "Windows Server 2003"
Else 'Future version maybe update
'as needed
sAns = "Unknown Windows Version"
End If
End Select

End Select
End With

Return sAns
End Function

However im unsure of the following bits?

If .Version.Revision.ToString() = "2222A" Then

??? any ideas

Posted

Thanks crahak for clearing that up for me, just a thought though. Would it be possible to make an .msi which would check to see what version the OS is and if its not 2003 kill the installer? would this be more efficant than having the application check the OS?

Posted (edited)

Gee. Thanks Yzöwl...

At least on newsgroups, there isn't one single person with god-like powers that can nuke your entire post if they feel like it over a slight difference of personal opinion about one sentence in it. They don't usually side with the trolls either.

No point in posting your section seemingly. Won't be making the error of wasting time on that anymore. I've edited all my posts in the section to reflect that.

Edited by crahak
Posted
That's nowhere close to a "solution". You're suggesting he should bypass the [very bloated] standard .NET classes
Fixed.

Wait a moment... this is .NET so I should just get out before I start getting influenced~! :hello:

Posted

Okay, I'm all for healthy debate!

Unfortunately crahak's latest post was a little bit beyond what I would term healthy and has as such been removed.

If you must fight, please keep it a clean.

Thank you.

Posted

lol sorry to have caused a fight :s

Anyways :) I was thinking instead of using the app to determin wheather or not its OS 'x' should I get the msi to do this, is this even possible or am I talking through my noobie hat?

Posted

Yes, a versioncheck can be done with the MSI.

See the (freely downloadable) MSI SDK documentation for more information.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...