本帖最后由 shenrenba 于 2010-8-20 15:55 编辑
比如下面的代码 我想在写入之前先查询HOSTS文件中是否已经写入 请问如何解决#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <File.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("注册表", 300, 200)
$Group1 = GUICtrlCreateGroup("Group1", 0, 0, 300, 300)
$Button1 = GUICtrlCreateButton("添加", 50,80,60,40)
$Button2 = GUICtrlCreateButton("删除", 200, 80, 60, 40)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
FileWrite(@SystemDir&"\drivers\etc\hosts","------ 屏蔽千千静听开始 ------"&@LF&"0.0.0.0 ttmsg.qianqian.com"&@LF&"------ 屏蔽千千静听结束 ------")
MsgBox(0,"","操作已完成")
EndSwitch
WEnd
|