GetSystemMetrics(SM_SERVERR2) Problem

  • Thread starter Thread starter OSVBNET
  • Start date Start date
O

OSVBNET

Guest
Hi,

In a legacy VB6 app, I am using GetVersionExA to get Windows Version:

Operating System Version - Windows applications

But how to distinguish Windows Server 2003 and 2003 R2, I found the only way would be:

GetSystemMetrics(SM_SERVERR2)

So I have:

Public Declare Function GetSystemMetrics Lib "user32" (nIndex As Long) As Long

Const SM_SERVERR2 As Long = 89&

If GetSystemMetrics(SM_SERVERR2) = 0 Then
GetVersion = "Windows Server 2003"
Else
GetVersion = "Windows Server 2003 R2"
End If
The problem is that GetSystemMetrics(SM_SERVERR2) ALWAYS RETURN 0, no matter if on 2003 or 2003 R2!
Am I missing something in my code or somewhere else?

Continue reading...
 
Back
Top