试一下这个:This MBM 4 program gives API and makes custom displays bossible, it need the MBM4 program!Goto take the MBM 4 program
http://mbm.livewiredev.com/download4.htm
Start it and run the VB code , it do share certain memory areas, I hope you like the solution as it
is not all VB code the DLL in this MBM program does the job.first Download and install the MNM4 version and start it.
Form1.timer code for 10 textboxes, need to set timer interval ~1000 to ~2000
Private Sub Timer1_Timer()
Dim test As MBMDATA
test = GetMBMData
Text1 = test.Temp1Name
Text2 = test.Temp1
Text3 = test.Temp2Name
Text4 = test.Temp2
Text5 = test.Volt1
Text6 = test.Volt2
Text7 = test.Volt3
Text8 = test.Volt4
Text9 = test.Fan1Name
Text10 = test.Fan1
End Sub
This is the modulle fixed by two declares they give:
Option Explicit
'Function declares and constants needed
Public Declare Function OpenFileMapping Lib "kernel32" Alias "OpenFileMappingA" _
(ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal lpName As String) As Long
Public Declare Function MapViewOfFile Lib "kernel32" (ByVal hFileMappingObject As Long, _
ByVal dwDesiredAccess As Long, ByVal dwFileOffsetHigh As Long, _
ByVal dwFileOffsetLow As Long, ByVal dwNumberOfBytesToMap As Long) As Long
Public Declare Function UnmapViewOfFile Lib "kernel32" (lpBaseAddress As Any) As Long
Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any,
ByVal Length As Long)
Public Const INVALID_HANDLE_VALUE = -1
Public Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Public Const STANDARD_RIGHTS_REQUIRED = &HF0000
Public Const SECTION_EXTEND_SIZE = &H10
Public Const SECTION_MAP_EXECUTE = &H8
Public Const SECTION_MAP_READ = &H4
Public Const SECTION_MAP_WRITE = &H2
Public Const SECTION_QUERY = &H1
Public Const SECTION_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED Or SECTION_QUERY Or _
SECTION_MAP_WRITE Or SECTION_MAP_READ Or SECTION_MAP_EXECUTE Or SECTION_EXTEND_SIZE
Public Const FILE_MAP_ALL_ACCESS = SECTION_ALL_ACCESS
Public Const FILE_MAP_COPY = SECTION_QUERY
Public Const FILE_MAP_READ = SECTION_MAP_READ
Public Const FILE_MAP_WRITE = SECTION_MAP_WRITE
'Data structure to hold data
Public Type MBMDATA
  MBMVersion As String * 44
  Temp1 As Double
  Temp2 As Double
  Temp3 As Double
  Volt1 As Double
  Volt2 As Double
  Volt3 As Double
  Volt4 As Double
  Volt5 As Double
  Volt6 As Double
  Volt7 As Double
  Fan1 As Long
  Fan2 As Long
  Fan3 As Long
  Temp1Name As String * 14
  Temp2Name As String * 14
  Temp3Name As String * 14
  Fan1Name As String * 14
  Fan2Name As String * 14
  Fan3Name As String * 14
  Suspend As Long
End Type
'Sub to get data
Public Function GetMBMData() As MBMDATA
  Dim lpData As Long
  Dim hMap As Long
  Dim dMBM As MBMDATA
 
  hMap = OpenFileMapping(FILE_MAP_ALL_ACCESS, 0, "$M$B$M$")
  If hMap = INVALID_HANDLE_VALUE Then
  'Can't get a handle to the shared data
      Exit Function
  Else
      lpData = MapViewOfFile(hMap, FILE_MAP_ALL_ACCESS, 0, 0, 0)
      If lpData = 0 Then
          'Can't map file
          Exit Function
      Else
          CopyMemory dMBM, ByVal lpData, Len(dMBM)
      End If
     
      Call UnmapViewOfFile(lpData)
      Call CloseHandle(hMap)
      
  End If
 
  GetMBMData = dMBM
  'The shared data will now reside in the dMBM variable.
  'You are now free to do what you like with the data.
  'Call GetMBMData again to refresh the data.  Maybe call it in a timer?
  'Could be an idea to change the sub to a function and pass the data back
  'or update a Public or Global variable.
 
End FunctionMatti