What do I need to use a public structure "_PROCESSOR_INFO_UNION"? Without it, "dwNumberOfProcessors" returns the actual number of processors instead of 15, but when it is used it returns 4
Import System.Runtime.InteropServices Folk Class Form1 & LT; DllImport ("kernel32.dll") & gt; _ Public Share Sub GetSystemInfo (& lt; MarshalAs (UnmanagedType.Struct) & gt; ByRef as lpSystemInfo SYSTEM_INFO) End Sub & LT; StructLayout (LayoutKind.Sequential) & gt; _ Public Structure SYSTEM_INFO friends uProcessorInfo as _PROCESSOR_INFO_UNION Public dwPageSize as UInteger Public lpMinimumApplicationAddress as IntPtr Public lpMaximumApplicationAddress as IntPtr Public dwActiveProcessorMask IntPtr Public dwNumberOfProcessors as UInteger Public dwProcessorType as UInteger Public dwAllocationGranularity as UInteger Public dwProcessorLevel as UShort Public dwProcessorRevision UShort end structure & lt As, StructLayout (LayoutKind.Explicit) & gt; _ Public structure _PROCESSOR_INFO_UNION '& lt; FieldOffset (0) & gt; _ 'United Guarded as a Friend' & lt; Field Offset (0) & gt; _ 'Friend wProcessorArchitecture as UShort' & lt; FieldOffset (2) & gt; _ 'Friend Ushort Ending Configuration Personal Sub Button1_Click (ByVal), as the System.Object Handle Button1.Click Dim infos New SYSTEM_INFO GetSystemInfo (infos) TextBox2.Text = (infos.dwNumberOfProcessors) In the form of sub wReserved end class
Modern processor a virtual
can be core, and there the physical machine you have to use this kind of syntax found on the actual number of processors found Sector front.
I have asked a similar question about the situation for C # time ago, and there I received a great answer about how to call it:
No comments:
Post a Comment