出現run time error 6 overflow 的字樣。
win7是32位系統的。
Private Type SYSTEM_INFO
dwOemID As Long
dwPageSize As Long
lpMinimumApplicationAddress As Long
lpMaximumApplicationAddress As Long
dwActiveProcessorMask As Long
dwNumberOrfProcessors As Long
dwProcessorType As Long
dwAllocationGranularity As Long
dwReserved As Long
End Type
Private Type MEMORYSTATUS
dwLength As Long
dwMemoryLoad As Long
dwTotalPhys As Long
dwAvailPhys As Long
dwTotalPageFile As Long
dwAvailPageFile As Long
dwTotalVirtual As Long
dwAvailVirtual As Long
End Type
Const SM_CXSCREEN = 0
Const SM_CYSCREEN = 1
Private Declare Function GetDriveType Lib "kernel32" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long
Private Declare Function GetDiskFreeSpace Lib "kernel32" Alias "GetDiskFreeSpaceA" (ByVal lpRootPathName As String, lpSectorsPerCluster As Long, lpBytesPerSector As Long, lpNumberOfFreeClusters As Long, lpTtoalNumberOfClusters As Long) As Long
Private Declare Sub GlobalMemoryStatus Lib "kernel32" (lpBuffer As MEMORYSTATUS)
Private Declare Sub GetSystemInfo Lib "kernel32" (lpSystemInfo As SYSTEM_INFO)
Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
Private Declare Function WNetGetConnection Lib "mpr.dll" Alias "WNetGetConnectionA" (ByVal lpszLocalName As String, ByVal lpszRemoteName As String, cbRemoteName As Long) As Long
Dim sinfo As SYSTEM_INFO
Dim minfo As MEMORYSTATUS
Private Sub Form_Load()
Dim aa As String
Dim strLocalIP As String
Dim winIP As Object
aa = aa & Environ("username") & vbCrLf
Set winIP = CreateObject("MSWinsock.Winsock")
strLocalIP = winIP.localip
Label18 = aa & "" & strLocalIP
SkinH_Attach
SkinH_SetAero 1
Set wmi = GetObject("winmgmts:\\.\root\CIMV2")
Set w = wmi.ExecQuery("select * from win32_processor")
For Each i In w
Label12 = vbCrLf & i.Name
Next
End Sub
Public Function GetCPUTemp() As Double
Dim i As Long
Dim mCPU As Variant
Dim u As Variant
Dim s As String
Set mCPU = GetObject("WINMGMTS:{impersonationLevel=impersonate}!root\wmi").ExecQuery("SELECT CurrentTemperature From MSAcpi_ThermalZoneTemperature")
For Each u In mCPU
s = s & u.CurrentTemperature
Next
Set mCPU = Nothing
GetCPUTemp = (s - 2732) / 10
End Function
Private Sub Label29_Click()
Shell "explorer " & "http://news.sohu.com/"
End Sub
Private Sub Label30_Click()
Shell "explorer " & "http://news.ifeng.com/"
End Sub
Private Sub Label31_Click()
Shell "explorer " & "http://taobao.com/"
End Sub
Private Sub Label32_Click()
Shell "explorer " & "http://123.sogou.com/xinwen/"
End Sub
Private Sub Label33_Click()
Shell "explorer " & "http://fanxing.kugou.com/"
End Sub
Private Sub Label34_Click()
Shell "explorer " & "http://www.xiami.com/"
End Sub
Private Sub Label35_Click()
Shell "explorer " & "http://paipai.com/"
End Sub
Private Sub Label36_Click()
Shell "explorer " & "http://youku.com/"
End Sub
Private Sub Label37_Click()
Shell "explorer " & "http://www.kankan.com/"
End Sub
Private Sub Label38_Click()
Shell "explorer " & "http://www.12306.cn/"
End Sub
Private Sub Label39_Click()
Shell "explorer " & "http://123.sogou.com/ting/"
End Sub
Private Sub Label40_Click()
Shell "explorer " & "http://kan.sogou.com/"
End Sub
Private Sub Label41_Click()
Shell "explorer " & "http://vip.etao.com/"
End Sub
Private Sub Timer1_Timer()
Label10.Caption = GetCPUTemp()
Label21.Caption = Format(Now, "YYYY年MM月DD日 hh:nn:ss")
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As ComctlLib.Button)
Select Case Button.Index
Case 1
MsgBox "功能暫未開發"
Case 3
MsgBox "功能暫未開發"
Case 5
MsgBox "功能暫未開發"
Case 7
MsgBox "功能暫未開發"
Case 9
MsgBox "功能暫未開發"
Case 11
MsgBox "功能暫未開發"
Case 13
MsgBox "功能暫未開發"
Case 15
MsgBox "功能暫未開發"
End Select
End Sub
在win xp 上可以運行,到了win7上就出現了這個

求大牛幫忙解決問題,謝謝了。
uj5u.com熱心網友回復:
幾十個label........你把表單的所有代碼(包括控制元件的配置)都貼出來......
uj5u.com熱心網友回復:
這個救了我的命、轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/129696.html
標籤:VB基礎類
