[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

About Operating System through Visual Basic

Posted on 1999-11-26
7
Medium Priority
?
194 Views
Last Modified: 2013-11-25
How can Identify the Operating system especially Arabic Enabled?,
I Needs in my software to Identify programatically.
0
Comment
Question by:kazendirane
  • 4
  • 3
7 Comments
 
LVL 3

Accepted Solution

by:
Foyal earned 40 total points
ID: 2237680
'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
 
LVL 5

Expert Comment

by:KDivad
ID: 2238663
>>'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
 
LVL 3

Expert Comment

by:Foyal
ID: 2238797
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 new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
LVL 5

Expert Comment

by:KDivad
ID: 2238972
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
 
LVL 3

Expert Comment

by:Foyal
ID: 2239148
Thanks KDivad
0
 
LVL 5

Expert Comment

by:KDivad
ID: 2240537
No problem.
0
 
LVL 3

Expert Comment

by:Foyal
ID: 377
I wonder... if you didn't know the answer would it still be worth a "C" to get it???? Asshole.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

591 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question