新手添加代码后运行报错
代码是在本论坛里找到的#NoTrayIcon#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_icon=00.ico
#AutoIt3Wrapper_outfile=121.exe
#AutoIt3Wrapper_UseUpx=n
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <File.au3>
Opt("GUICloseOnESC", 0)
Dim $aRecords, $S = 1
If Not _FileReadToArray(@ScriptDir & "\资料.txt", $aRecords) Then
MsgBox(0, "错误", "请检查身份信息文件是否存在!")
Exit
EndIf
$Form2 = GUICreate("博吧专用", 319, 120)
$Button1 = GUICtrlCreateButton("刷新", 232, 24, 75, 20, 0)
$Button2 = GUICtrlCreateButton("填写", 232, 72, 75, 20, 0)
$Label1 = GUICtrlCreateLabel("姓名", 16, 28, 40, 17)
$Label2 = GUICtrlCreateLabel("身份证", 16, 76, 40, 17)
$Input1 = GUICtrlCreateInput("", 64, 24, 121, 21, $ES_AUTOHSCROLL)
$Input2 = GUICtrlCreateInput("", 64, 72, 121, 21)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
GUICtrlSetData($Input1, "")
GUICtrlSetData($Input2, "")
If $S > $aRecords Then $S = 1
If $aRecords[$S] <> "" Then
$aRecords[$S] = StringStripWS($aRecords[$S], 8)
$Len = StringLen($aRecords[$S])
For $I = 1 To $Len
$sfz = StringTrimLeft($aRecords[$S], $I)
$Int = StringIsInt($sfz)
If $Int = 1 Then
$xm = StringLeft($aRecords[$S], $I)
GUICtrlSetData($Input1, $xm)
GUICtrlSetData($Input2, $sfz)
$I = $Len
EndIf
Next
$S = $S + 1
EndIf
Case $Button2
$Exists = WinExists("常用操作", "")
If $Exists = 1 Then
WinActivate("常用操作", "")
WinWaitActive ("", "")
ControlSetText("", "", "ThunderRT6TextBox157", GUICtrlRead($Input1))
ControlSetText("", "", "ThunderRT6TextBox156", GUICtrlRead($Input2))
Else
MsgBox(0, "错误", "请先打开开卡页面")
EndIf
EndSwitch
WEnd我需要加入点击最小化和关闭按钮都最小化到托盘的功能,在论坛搜索到了相关代码;下边有两种方法,自己看着用。
;按关闭按钮时隐藏窗口
case $msg = $GUI_EVENT_CLOSE
GUISetState(@SW_HIDE,$hgui)
;按最小化按钮时隐藏窗口
Case $GUI_EVENT_MINIMIZE
guisetstate(@SW_MINIMIZE,$hgui)但是加入后运行是报错的
“错误: 表达式错误确 case” Opt("TrayIconHide", 0)
GUISetState(@SW_HIDE, $Form1)
TrayTip("提示:", "窗口已被最小化,单击此图标返回.", 10)
恢复窗口
Opt("TrayIconHide", 1)
GUISetState(@SW_SHOW, $Form1)用这个代码运行也报错,求大哥们指点一下。。 $hgui
$Form1
你的窗口是$Form2啊
页:
[1]