]#include <GuiConstants.au3>
#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <WindowsConstants.au3>
#include <File.au3>
#include <Array.au3>
#include <Process.au3>
#include <Debug.au3>
;Opt('MustDeclareVars', 1)
Global $sFilename = @ScriptFullPath
Global $isofile
Dim $pthDrive, $pthDir, $pthFName, $pthExt
$isocmddir=@AppDataCommonDir&"\isocmd.exe"
;~ if not FileExists($isocmddir) Then
FileInstall("isocmd.exe",$isocmddir)
$sysdir=@AppDataCommonDir&"\ISODrive.sys"
;~ if not FileExists($sysdir)Then
FileInstall("ISODrive.sys",$sysdir)
$hGui = GUICreate("虚拟光驱", 180, 20, -1, -1, BitOR($WS_POPUPWINDOW, $WS_CLIPSIBLINGS,$WS_EX_TOPMOST ),$WS_EX_ACCEPTFILES) ;接受拖放文件
$Edit = GUICtrlCreateLabel("请拖放光盘镜像到方框中!", 1, 1, 178, 18, $ES_CENTER)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
;GUICtrlSetState(-1, $GUI_HIDE)
GUICtrlSetState(-1, $GUI_ACCEPTFILES) ;接受拖放文件
GUICtrlSetBkColor($Edit, 0xff0000)
GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
if FileExists ($isocmddir) Then FileDelete($isocmddir)
if FileExists ($sysdir) Then FileDelete($sysdir)
ExitLoop
Case $msg = $GUI_EVENT_DROPPED
$isofile = @GUI_DragFile
$isocmdshort=FileGetShortName($isocmddir)
$isofileshort=FileGetShortName($isofile)
$eachPath = _PathSplit($isofile, $pthDrive, $pthDir, $pthFName, $pthExt)
If $isofile = "" Then
GUICtrlSetData($Edit,"请拖放光盘镜像到方框中!")
ElseIf StringRight($isofile, 3) <> "iso" And StringRight($isofile, 3) <> "udf"And StringRight($isofile, 3) <> "exe" Then
GUICtrlSetData($Edit,"并不是一个支持的映像文件!")
Else
ShellExecute($isocmdshort,"-r ","","open",@SW_HIDE )
ShellExecute($isocmdshort,"-is ","","open",@SW_HIDE)
ShellExecute($isocmdshort,"-changge 1 x: ","","open",@SW_HIDE)
ShellExecute($isocmdshort,"-mount x: "&$isofileshort,"","open",@SW_HIDE)
ShellExecute($isocmdshort,"-v ","","open",@SW_HIDE)
GUICtrlSetData($Edit,"镜像已加载!")
GUICtrlSetBkColor(-1, 0x00ff00)
;MsgBox(0, "恭喜!", "创建虚拟光驱成功!"&@LF&$pthDrive&$pthDir&$pthFName&$pthExt&"已加载!")
EndIf
Case $msg = $GUI_EVENT_PRIMARYDOWN
$isofile =GUICtrlRead($Edit)
$isocmdshort=FileGetShortName($isocmddir)
$isofileshort=FileGetShortName($isofile)
$eachPath = _PathSplit($isofile, $pthDrive, $pthDir, $pthFName, $pthExt)
_RunDOS($isocmdshort&" -eject x:")
GUICtrlSetData($Edit,"请拖放光盘镜像到方框中!")
GUICtrlSetBkColor(-1, 0xff0000)
EndSelect
WEnd
Exit