for a what I need to use Public Structure "_PROCESSOR_INFO_UNION"? Without it "dwNumberOfProcessors" returns 15 instead of real number of processors, but when it used it's returns 4
Imports System.Runtime.InteropServices Public Class Form1
<DllImport("kernel32.dll")> _
Public Shared Sub GetSystemInfo(<MarshalAs(UnmanagedType.Struct)> ByRef lpSystemInfo As SYSTEM_INFO)
End Sub
<StructLayout(LayoutKind.Sequential)> _
Public Structure SYSTEM_INFO
Friend uProcessorInfo As _PROCESSOR_INFO_UNION
Public dwPageSize As UInteger
Public lpMinimumApplicationAddress As IntPtr
Public lpMaximumApplicationAddress As IntPtr
Public dwActiveProcessorMask As IntPtr
Public dwNumberOfProcessors As UInteger
Public dwProcessorType As UInteger
Public dwAllocationGranularity As UInteger
Public dwProcessorLevel As UShort
Public dwProcessorRevision As UShort
End Structure
<StructLayout(LayoutKind.Explicit)> _
Public Structure _PROCESSOR_INFO_UNION
'<FieldOffset(0)> _
'Friend dwOemId As UInteger
'<FieldOffset(0)> _
'Friend wProcessorArchitecture As UShort
'<FieldOffset(2)> _
'Friend wReserved As UShort
End Structure
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim infos As New SYSTEM_INFO
GetSystemInfo(infos)
TextBox2.Text = (infos.dwNumberOfProcessors)
End Sub
End Class