Determining host operating system using VB 6

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
elizas
Posts: 1
Joined: Wed 09 Jun 2010, 08:48

Determining host operating system using VB 6

#1 Post by elizas »

Hi all,
I am sharing this topic with you.Hope u all find this very interesting.
Any suggestions are appreciated.

The first step is to make some simple declarations. Add the following code to your projects declarations.

Private Const VER_PLATFORM_WIN32s = 0
Private Const VER_PLATFORM_WIN32_WINDOWS = 1
Private Const VER_PLATFORM_WIN32_NT As Long = 2

Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (lpVersionInformation As Any) As Long

Private Type OSVERSIONINFO
OSVSize As Long
dwVerMajor As Long
dwVerMinor As Long
dwBuildNumber As Long
PlatformID As Long
szCSDVersion As String * 128
End Type

After we are done with the above declaration we can have some methods/functions to determine current OS as shown below.

# 1.
Public Function IdentifyOperatingSystem() As String
Dim rOsVersionInfo As OSVERSIONINFO
Dim sOperatingSystem As String
sOperatingSystem = "NONE"
rOsVersionInfo.OSVSize = Len(rOsVersionInfo)
If GetVersionEx(rOsVersionInfo) Then
Select Case rOsVersionInfo.PlatformID

http://www.mindfiresolutions.com/Determ ... -6-189.php

User avatar
Sit Heel Speak
Posts: 2595
Joined: Fri 31 Mar 2006, 03:22
Location: downwind

#2 Post by Sit Heel Speak »

This seems interesting but I do not really know what I'm looking at.

I do not know Windows VB6 at all, so no doubt the questions below show my ignorance, but...

Is it the purpose of this program, to return the exact identity of the Windows OS under which, say, QEMU, is being run?

If yes, does it return the identity to Windows, or can it be adapted to return the information to Linux?

If I am on the right track...is there a way to identify exactly which Windows is being run, in the case where it is something newer than NT, i.e. does this code snippet return

XP
Vista
Windows Seven

or, better, information which is even more detailed, i.e. includes the subversion (e.g. "Windows Seven 64-bit Ultimate," Windows XP 32-bit Media Edition 2005", and the like)?

User avatar
Iguleder
Posts: 2026
Joined: Tue 11 Aug 2009, 09:36
Location: Israel, somewhere in the beautiful desert
Contact:

#3 Post by Iguleder »

It's called uname. And yes, you can get uname for Windows.
[url=http://dimakrasner.com/]My homepage[/url]
[url=https://github.com/dimkr]My GitHub profile[/url]

Post Reply