找回密码
 加入
搜索
查看: 3825|回复: 6

[AU3基础] 编译通过没有报错,运行也可以,在退出时提示出错

  [复制链接]
发表于 2010-12-21 22:41:37 | 显示全部楼层 |阅读模式
编译通过没有报错,运行也可以,在退出时提示出错,如图:

代码如下:
#NoTrayIcon
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_icon=4.ico
#AutoIt3Wrapper_outfile=电脑硬件信息查看器.exe
#AutoIt3Wrapper_Compression=3
#AutoIt3Wrapper_Res_Comment=简单的硬件信息查看工具
#AutoIt3Wrapper_Res_Description=硬件信息查看工具
#AutoIt3Wrapper_Res_Fileversion=2.0.1.0
#AutoIt3Wrapper_Res_LegalCopyright=shengda79.com
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <GUIConstants.au3>
#include <Misc.au3>
#include <EditConstants.au3>
#include <WindowsConstants.au3>

$hGui=GUICreate ("硬件信息查看器",450,400,-1,-1)
;加载皮肤
Dim $Dll   
FileInstall("SkinCrafterDll.dll", @TempDir& "\SkinCrafterDll.dll",1)
FileInstall("vista_style.skf", @TempDir& "\vista_style.skf",1)
$Dll = DllOpen(@TempDir& "\SkinCrafterDll.dll")
DllCall($Dll, "int:cdecl", "InitLicenKeys", "wstr", "1", "wstr", "", "wstr", "1@1.com", "wstr", "1")
DllCall($Dll, "int:cdecl", "InitDecoration", "int", 1)
DllCall($Dll, "int:cdecl", "LoadSkinFromFile", "wstr", @TempDir& "\vista_style.skf")
DllCall($Dll, "int:cdecl", "DecorateAs", "int", $hGui, "int", 25)
DllCall($Dll, "int:cdecl", "ApplySkin")

Opt('MustDeclareVars', 1)
Opt("GUIOnEventMode", 1)



Global $hGui,$bios,$board,$cpu,$display,$sound,$network,$mem,$os

SplashImageOn("logo","Splash.jpg",425,200,-1,-1,1)


GUISetOnEvent($GUI_EVENT_CLOSE, "_hGuiMsg")
GUICtrlCreateGroup ("信息选项", 10, 10, 430, 360)

GUICtrlCreateButton("C  P  U",25,40,80,30)
$cpu=GUICtrlCreateInput("",120,40,270,30,$ES_READONLY)

GUICtrlCreateButton("B I O S",25,80,80,30)
$bios=GUICtrlCreateInput("",120,80,270,30,$ES_READONLY)


GUICtrlCreateButton("主    板",25,120,80,30)
$board=GUICtrlCreateInput("",120,120,270,30,$ES_READONLY)


GUICtrlCreateButton("显    卡",25,160,80,30)
$display=GUICtrlCreateInput("",120,160,270,30,$ES_READONLY)

GUICtrlCreateButton("声    卡",25,200,80,30)
$sound=GUICtrlCreateInput("",120,200,270,30,$ES_READONLY)

GUICtrlCreateButton("网    卡",25,240,80,30)
$network=GUICtrlCreateInput("",120,240,270,30,$ES_READONLY)

GUICtrlCreateButton("内    存",25,280,80,30)
$mem=GUICtrlCreateInput("",120,280,270,30,$ES_READONLY)

GUICtrlCreateButton("操作系统",25,320,80,30)
$os=GUICtrlCreateInput("",120,320,270,30,$ES_AUTOHSCROLL+$ES_READONLY)

GUICtrlCreateGroup ("",-99,-99,1,1)
GUICtrlCreateLabel("春花秋月制作",350,380,100,30)

  

GUISetState()

info()
SplashOff()
While 1
       
Local $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', @AutoItPID)
Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $ai_Handle[0])
DllCall("kernel32.dll" , 'int', 'CloseHandle', 'int', $ai_Handle[0])
Sleep(1000)

Wend

Func _hGuiMsg()
  Switch @GUI_CTRLID
          
            Case  $GUI_EVENT_CLOSE
                         Exit                                                       
        Case $GUI_EVENT_MINIMIZE
                guisetstate(@SW_MINIMIZE)
        Case $GUI_EVENT_RESTORE
                guisetstate(@SW_RESTORE)
                EndSwitch
               
EndFunc  ;==>_hGuiMsg()
       
Func info()
      
Global $objWMIService,$colBios,$colBoard,$colSettings,$colMemory,$colCPU,$colVideoinfo,$colSound ,$colNIC

Local $object,$objOperatingSystem
$objWMIService = objget("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
$colBios = $objWMIService.ExecQuery("Select * from Win32_BIOS")
$colBoard = $objWMIService.ExecQuery("SELECT * FROM Win32_BaseBoard")
$colSettings = $objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
$colMemory = $objWMIService.ExecQuery("Select * from Win32_ComputerSystem")
$colCPU = $objWMIService.ExecQuery("Select * from CIM_Processor")
$colVideoinfo = $objWMIService.ExecQuery("Select * from Win32_VideoController")
$colSound = $objWMIService.ExecQuery("Select * from Win32_SoundDevice")
$colNIC = $objWMIservice.ExecQuery("Select * from Win32_NetworkAdapter WHERE Netconnectionstatus = 2")

For $object in $colCPU
        GUICtrlSetData($cpu, StringStripWS($object.Name,1))
Next
       
For $object in $colBios
        GUICtrlSetData($bios,StringMid($object.Caption,1))
Next



For $object in $colBoard
        GUICtrlSetData($board,$object.Product)
        
Next




For $object in $colVideoinfo
        GUICtrlSetData($display, StringStripWS($object.Description ,1))
  
Next

For $object in $colSound
        GUICtrlSetData($sound, StringStripWS($object.Description ,1))
  Next

For $object in $colNIC
        GUICtrlSetData($network, StringStripWS($object.name ,1))
  
Next


For $objOperatingSystem in $colSettings

GUICtrlSetData($os,$objOperatingSystem.Caption & " Build " & $objOperatingSystem.BuildNumber & " Sp " & $objOperatingSystem.ServicePackMajorVersion & "." & $objOperatingSystem.ServicePackMinorVersion )

Next
for $object  in $colMemory
        GUICtrlSetData($mem,String(Int(Number($object.TotalPhysicalMemory) / (1024 * 1024))) & " Mb")
Next

EndFunc  ;==>Info()



Func Quit()
    GUISetState(@SW_HIDE)
    DllCall($dll, "int", "DeInitDecoration")
    DllCall($dll, "int", "RemoveSkin")
    DllClose($dll)
    FileDelete ( @TempDir&"\SkinCrafterDll.dll" )
    FileDelete ( @TempDir&"\vista_style.skf" )
    Exit
EndFunc

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2010-12-22 07:50:47 | 显示全部楼层
$GUI_EVENT_CLOSE
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;&#160; &#160;&#160; &#160;&#160; &#160; Exit
改成
$GUI_EVENT_CLOSE
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;&#160; &#160;Quit()&#160; &#160;&#160; &#160;
 楼主| 发表于 2010-12-22 13:02:30 | 显示全部楼层
回复 2# gzh888666 谢谢你的指点,还真的是OK了!谢谢!
发表于 2010-12-22 13:32:49 | 显示全部楼层
回复 2# gzh888666


    为什么?
发表于 2010-12-22 13:49:16 | 显示全部楼层
本帖最后由 gzh888666 于 2010-12-22 13:51 编辑

多看帮助,quit()是函数!指定了是从哪里退出的!
发表于 2010-12-22 15:12:45 | 显示全部楼层
回复 4# yarsye
皮肤未释放。
发表于 2010-12-23 18:21:51 | 显示全部楼层
同样的问题问了两次!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-11-24 07:14 , Processed in 0.081138 second(s), 22 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表