找回密码
 加入
搜索
查看: 9170|回复: 18

请高手帮忙,autoit 能不能查看本地硬盘ID吗?

 火.. [复制链接]
发表于 2009-2-15 18:27:05 | 显示全部楼层 |阅读模式
autoit 能不能查看本地所有硬盘的ID信息?

[ 本帖最后由 zpl13 于 2009-2-16 12:39 编辑 ]
发表于 2009-2-15 20:48:33 | 显示全部楼层
AU3基本不与硬件打交道,可能需要第三方了
发表于 2009-2-15 21:04:59 | 显示全部楼层
sanhen不是有一个发在论坛上的吗 问之前先搜一搜啊
发表于 2009-2-15 21:29:21 | 显示全部楼层
$strComputer = "."
$objWMIService = ObjGet("winmgmts:"& "{impersonationLevel=impersonate}!\\" & $strComputer & "\root\cimv2")
$colItems = $objWMIService.ExecQuery("Select * From Win32_LogicalDisk Where DriveType = 3")
For $objItem in $colItems
MsgBox (0,"",$objItem.DeviceID)
Next

大哥问之前能自己先想想吗?
发表于 2009-2-16 08:35:09 | 显示全部楼层
调用WMI,能解决很多问题的
 楼主| 发表于 2009-2-16 12:41:45 | 显示全部楼层
新手,搜了没搜到!
谢谢各位了
发表于 2009-2-16 15:35:17 | 显示全部楼层
这个比较全
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
FileInstall("xuanfeng.dll",@TempDir&"\xuanfeng.dll",1)
GUICreate("读取硬盘信息", 234, 266, @DesktopWidth/2-(234/2), @DesktopHeight/2-(266/2))
$Input1 = GUICtrlCreateInput("", 95, 7, 129, 21,$ES_READONLY)
$Input2 = GUICtrlCreateInput("", 95, 39, 129, 21,$ES_READONLY)
$Input3 = GUICtrlCreateInput("", 95, 71, 129, 21,$ES_READONLY)
$Input4 = GUICtrlCreateInput("", 95, 103, 129, 21,$ES_READONLY)
$Input5 = GUICtrlCreateInput("", 95, 135, 129, 21,$ES_READONLY)
$Input6 = GUICtrlCreateInput("", 95, 167, 129, 21,$ES_READONLY)
$Input7 = GUICtrlCreateInput("", 95, 199, 129, 21,$ES_READONLY)
GUICtrlCreateLabel("硬 盘序列号 :", 9, 10, 79, 17)
GUICtrlCreateLabel("品 牌 型 号 :", 9, 42, 79, 17)
GUICtrlCreateLabel("修 正 版 本 :", 9, 74, 79, 17)
GUICtrlCreateLabel("缓 冲 大 小 :", 9, 106, 79, 17)
GUICtrlCreateLabel("柱 面 数 量 :", 9, 138, 79, 17)
GUICtrlCreateLabel("盘 头 大 小 :", 9, 170, 79, 17)
GUICtrlCreateLabel("每磁道扇区数:", 9, 202, 79, 17)
$quit=GUICtrlCreateButton("退出", 144, 232, 73, 25, 0)
$read=GUICtrlCreateButton("读取", 15, 232, 73, 25, 0)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $GUI_EVENT_CLOSE
   FileDelete(@TempDir&"\xuanfeng.dll")
   Exit
  Case $quit
   FileDelete(@TempDir&"\xuanfeng.dll")
   Exit
  Case $read
   dll()
EndSwitch
Sleep(1)
WEnd
Func dll()
$sn = dllcall(@TempDir&"\xuanfeng.dll","int","GetSerialNumber","int","nDrive","str","lpBuffer")     ;序列号
If @error Then 
MsgBox(0,"错误","DLL文件调用错误,"&@LF&"错误代码:"&@error)
Exit
EndIf
$mn = dllcall(@TempDir&"\xuanfeng.dll","int","GetModelNumber","int","nDrive","str","lpBuffer")      ;品牌
$rn = dllcall(@TempDir&"\xuanfeng.dll","int","GetRevisionNumber","int","nDrive","str","lpBuffer")   ;版本号
$bs = dllcall(@TempDir&"\xuanfeng.dll","int","GetBufferSize","int","nDrive")                        ;缓冲大小
$dc = dllcall(@TempDir&"\xuanfeng.dll","int","GetDiskCylinders","int","nDrive")                     ;柱面数量
$dh = dllcall(@TempDir&"\xuanfeng.dll","int","GetDiskHeads","int","nDrive")                         ;盘头大小
$st = dllcall(@TempDir&"\xuanfeng.dll","int","GetSectorsOfTrack","int","nDrive")                    ;每磁道扇区数
GUICtrlSetData($Input1,$sn[2])
GUICtrlSetData($Input2,$mn[2])
GUICtrlSetData($Input3,$rn[2])
GUICtrlSetData($Input4,$bs[0])
GUICtrlSetData($Input5,$dc[0])
GUICtrlSetData($Input6,$dh[0])
GUICtrlSetData($Input7,$st[0])
EndFunc

本帖子中包含更多资源

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

×
发表于 2009-12-26 15:12:31 | 显示全部楼层
不错,顶了~
发表于 2010-2-1 18:05:48 | 显示全部楼层
好东西............
发表于 2010-4-2 19:46:12 | 显示全部楼层
好。 我喜欢。 谢谢了。
发表于 2010-4-2 19:49:05 | 显示全部楼层
回复 4# xrbenbeba


    说实话,对你这个不是很懂。 我复制了下来。 运行了一下。 出来的。 C:,D:,E:

我的三个分区。没有出来硬盘ID ?
发表于 2010-7-30 12:56:57 | 显示全部楼层
回复 7# 35888894 还好的东西,不知道能不能看看xuanfeng.dll更详细的东西
发表于 2010-9-12 17:45:32 | 显示全部楼层
找了一下午,这个最好用,多谢了。
发表于 2010-9-21 17:15:08 | 显示全部楼层
试试,感谢
发表于 2011-4-1 16:48:56 | 显示全部楼层
很不错~值得一看
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-28 22:20 , Processed in 0.087518 second(s), 21 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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