Help and Support
 

powered byLive Search

How to Determine If a VB App is Running Under Windows NT 3.x

Retired KB ArticleThis article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.
Article ID:122353
Last Review:December 9, 2003
Revision:2.0
This article was previously published under Q122353
On This Page

SUMMARY

There are some scenarios in which your program should behave differently when running under Windows NT version 3.x instead of under Windows version 3.x. For example, an application based on Windows NT needs to handle networking API calls differently. Therefore it is important to find out whether or not your Visual Basic program is running under Windows NT. This article shows you how.

Back to the top

MORE INFORMATION

A call to the Windows API GetWinFlags function returns a 32-bit value representing the current system status. By performing a binary AND on this flag with the hexadecimal value &h4000, you can determine whether the underlying operating system is Windows NT version 3.x or not.

Back to the top

Step-by-Step Example

1.Start a new project in Visual Basic. Form1 is created by default.
2.Place a command button (Command1) on Form1.
3.Add the following code to the general declarations section of Form1:
   Const WF_WINNT = &H4000&
   Declare Function GetWinFlags Lib "KERNEL" () As Long

   Function IsWindowsNT() As Integer
      IsWindowsNT = (GetWinFlags() And WF_WINNT)
   End Function
						
4.Add the following code to the Command1 Click event procedure:
   Sub Command1_Click()
      If IsWindowsNT() Then
         MsgBox "You are running under Windows NT"
      Else
         MsgBox "You are running under Windows version 3.x"
      End If
   End Sub
						
5.Test the program by running it and clicking the command button.

Back to the top


APPLIES TO
Microsoft Visual Basic 2.0 Standard Edition
Microsoft Visual Basic 3.0 Professional Edition
Microsoft Visual Basic 2.0 Professional Edition

Back to the top

Keywords: 
kbenv kbhowto KB122353

Back to the top

Article Translations

 

Other Support Options

  • Need More Help?
    Contact a Support professional by E-mail, Online or Phone.
  • Customer Service
    For non-technical assistance with product purchases, subscriptions, online services, events, training courses, corporate sales, piracy issues, and more.
  • Newsgroups
    Pose a question to other users. Discussion groups and Forums about specific Microsoft products, technologies, and services.