About Operating System through Visual Basic

How can Identify the Operating system especially Arabic Enabled?,
I Needs in my software to Identify programatically.
kazendiraneAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

FoyalCommented:
'Create a new form with 3 label controls
'named lblWinVer, lblCountry, and lblLanguage.
'Add the following code...
'(be sure to fix the word wraps!)

Option Explicit

Private Type OSVERSIONINFO
    dwOSVersionInfoSize As Long
    dwMajorVersion As Long
    dwMinorVersion As Long
    dwBuildNumber As Long
    dwPlatformId As Long
    szCSDVersion As String * 128
End Type

Dim MyVer As OSVERSIONINFO

Const VER_PLATFORM_WIN32_NT = 2
Const VER_PLATFORM_WIN32_WINDOWS = 1

Const LOCALE_USER_DEFAULT = &H400

Const LOCALE_SENGCOUNTRY = &H1002
Const LOCALE_SENGLANGUAGE = &H1001

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

Private Declare Function GetLocaleInfo Lib _
"kernel32" Alias "GetLocaleInfoA" _
(ByVal Locale As Long, ByVal LCType As Long, _
ByVal lpLCData As String, ByVal cchData As Long) As Long

Private Sub Form_Load()
       
    Dim T As Long
    Dim S As String
    Dim Buffer As String * 100
     
    MyVer.dwOSVersionInfoSize = 148
       
    T = GetVersionEx(MyVer)
       
    If MyVer.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS Then
        S = " Windows 95 Version "
    ElseIf MyVer.dwPlatformId = VER_PLATFORM_WIN32_NT Then
        S = " Windows NT Version "
    End If
   
    S = S & MyVer.dwMajorVersion & "." & _
    MyVer.dwMinorVersion
   
    If Len(MyVer.szCSDVersion) > 0 Then
        S = S & MyVer.szCSDVersion
    End If
       
    lblWinVer = S
   
    T = GetLocaleInfo(LOCALE_USER_DEFAULT, _
    LOCALE_SENGCOUNTRY, Buffer, 99)
   
    lblCountry.Caption = " Country: " & Trim(Buffer)
   
    T = GetLocaleInfo(LOCALE_USER_DEFAULT, _
    LOCALE_SENGLANGUAGE, Buffer, 99)
   
    lblLanguage.Caption = " Language: " & Trim(Buffer)
   
End Sub

'This should work fine for Win95 and NT
'You will need to add another constant
'to detect Win98. I don't know that one.
'Hope this helps...
'See 'ya,
'Foyal:   foyalcarter@mciworld.com
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
KDivadCommented:
>>'You will need to add another constant
'to detect Win98. I don't know that one.<<

Win98 also returns "VER_PLATFORM_WIN32_WINDOWS" for MyVer.dwPlatformId, so you'll have to find another way to distinguish them.
0
FoyalCommented:
KDivad-

    I haven't messed with Win98... Can the platform be distinguished with the  version numbers? If so, this code could be easily fixed.

Thanks,
Foyal
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

KDivadCommented:
I think so. Here's some version info for you to compare:

Your code:
4.1
Kernel32 (Windows' core) properties:
4.10.1998
Kernel32 on my Win95B machine:
4.00.1111

Looks like Win95 has a version of 4.0 and Win98 has a version of 4.1. I suspect that if you get the version info for Kernel32 then you can tell exactly which version of Windows you are running. Since it's THE core component of Windows, it will have to have a different version number for each version of Windows.

Hope this helps!
0
FoyalCommented:
Thanks KDivad
0
KDivadCommented:
No problem.
0
FoyalCommented:
I wonder... if you didn't know the answer would it still be worth a "C" to get it???? Asshole.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.