Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

I found this API

Private Declare Sub GetSystemInfo Lib "kernel32.dll" (ByRef lpSystemInfo As SYSTEM_INFO)
   Private Structure SYSTEM_INFO
       Public dwOemID As Int32
       Public dwPageSize As Int32
       Public lpMinimumApplicationAddress As Int32
       Public lpMaximumApplicationAddress As Int32
       Public dwActiveProcessorMask As Int32
       Public dwNumberOrfProcessors As Int32
       Public dwProcessorType As Int32
       Public dwAllocationGranularity As Int32
       Public dwReserved As Int32
   End Structure

Edited by AndreRyan
.Net allows software to be written for any version of Windows and not break like Unmanaged applications unless using Unmanaged procedures like APIs. If your program uses large amounts of memory but releases it when something else needs it, then what's the problem?
Posted

I don't know. Try some things:

IntPtr ptr = GetSystemInfo.SYSTEM_INFO.dwProcessorType;

That is C# syntax.

Fool around a little and you will probably get it.

By the way, you need to copy and paste AndreRyan's code into your app first.

C#
  • Leaders
Posted
   Private Declare Sub GetSystemInfo Lib "kernel32.dll" (ByRef lpSystemInfo As SYSTEM_INFO)
   Private Structure SYSTEM_INFO
       Public dwOemID As Int32
       Public dwPageSize As Int32
       Public lpMinimumApplicationAddress As Int32
       Public lpMaximumApplicationAddress As Int32
       Public dwActiveProcessorMask As Int32
       Public dwNumberOrfProcessors As Int32
       Public dwProcessorType As Int32
       Public dwAllocationGranularity As Int32
       Public dwReserved As Int32
   End Structure

   Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
       Dim s As SYSTEM_INFO
       GetSystemInfo(s)
       MsgBox(s.dwProcessorType & Chr(10) & s.dwNumberOrfProcessors & Chr(10) & s.dwPageSize)
   End Sub

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...