关于循环问题,路过高手看看。谢谢各位朋友的帮忙[已解决]
本帖最后由 yingf20 于 2010-9-16 09:25 编辑例子:
While 1
$Msg = GUIGetMsg()
Select
Case $Msg = $GUI_EVENT_CLOSE
Exit
Case $Msg = $Browse1
;我想在这里设个连接跳到下个$Browse4运行。知道的朋友帮忙一下。在此谢谢
Case $Msg = $Browse2
;我想在这里设个连接跳到下个$Browse4运行。知道的朋友帮忙一下。在此谢谢
Case $Msg = $Browse3
;我想在这里设个连接跳到下个$Browse4运行。知道的朋友帮忙一下。在此谢谢
Case $Msg = $Browse4
EndSelect
WEnd
如果有些朋友用如下方法的就不要回复。
While 1
$Msg = GUIGetMsg()
Select
Case $Msg = $GUI_EVENT_CLOSE
Exit
Case $Msg = $Browse1
YF()
Case $Msg = $Browse2
YF()
Case $Msg = $Browse3
YF()
EndSelect
WEnd
Func YF()
exit
EndFunc;========>
怎么光看,没有高手经过的。 加个if让$Browse4=$Browse1 试试下面的效果,看是否符合要求。#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
Example()
Func Example()
Local $Button_1, $Button_2, $Button_3, $Button_4, $msg
GUICreate("My GUI Button")
Opt("GUICoordMode", 2)
$Button_1 = GUICtrlCreateButton("Button_1", 10, 30, 90)
$Button_2 = GUICtrlCreateButton("Button_2", 0, -1)
$Button_3 = GUICtrlCreateButton("Button_3", 0, -1)
$Button_4 = GUICtrlCreateButton("Button_4", 0, -1)
GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $Button_1
GUICtrlSendMsg($Button_4, $BM_CLICK, 0, 0)
Case $msg = $Button_2
GUICtrlSendMsg($Button_4, $BM_CLICK, 0, 0)
Case $msg = $Button_3
GUICtrlSendMsg($Button_4, $BM_CLICK, 0, 0)
Case $msg = $Button_4
Run('Notepad.exe')
EndSelect
WEnd
EndFunc 楼上的,请问还有别的方法不?知道的朋友多给发些分享。。
在此谢谢。多收集有益。呵 _GUICtrlButton_Click 也可以#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
Example()
Func Example()
Local $Button_1, $Button_2, $Button_3, $Button_4, $msg
GUICreate("My GUI Button")
Opt("GUICoordMode", 2)
$Button_1 = GUICtrlCreateButton("Button_1", 10, 30, 90)
$Button_2 = GUICtrlCreateButton("Button_2", 0, -1)
$Button_3 = GUICtrlCreateButton("Button_3", 0, -1)
$Button_4 = GUICtrlCreateButton("Button_4", 0, -1)
GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $Button_1
_GUICtrlButton_Click($Button_4)
Case $msg = $Button_2
MsgBox(0, 0, "我是Button_2")
Case $msg = $Button_3
MsgBox(0, 0, "我是Button_3")
Case $msg = $Button_4
MsgBox(0, 0, "我是Button_4")
EndSelect
WEnd
EndFunc ;==>Example 回复 5# yingf20
四楼的代码是不能实现你的功能?还是要换种形式的?如果是达不到你的功能需求,麻烦你详细描述一下;下面是另外一种形式的代码,功能和上面是一样的,更简单些,头文件 ButtonConstants.au3 都可以略掉。#include <GUIConstantsEx.au3>
Example()
Func Example()
Local $hWnd, $Button_1, $Button_2, $Button_3, $Button_4, $msg
$hWnd = GUICreate("My GUI Button")
Opt("GUICoordMode", 2)
$Button_1 = GUICtrlCreateButton("Button_1", 10, 30, 90)
$Button_2 = GUICtrlCreateButton("Button_2", 0, -1)
$Button_3 = GUICtrlCreateButton("Button_3", 0, -1)
$Button_4 = GUICtrlCreateButton("Button_4", 0, -1)
GUISetState()
While 1
$msg = GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE
ExitLoop
Case $Button_1
ControlClick($hWnd, '', $Button_4)
Case $Button_2
ControlClick($hWnd, '', $Button_4)
Case $Button_3
ControlClick($hWnd, '', $Button_4)
Case $Button_4
Run('Notepad.exe')
EndSwitch
WEnd
EndFunc 本帖最后由 yingf20 于 2010-9-16 09:33 编辑
回复 7# baikaifang
谢谢你给的代码。我用了你的方法,感觉不错。
4楼的也不错。在此谢谢各位热心的朋友。6楼的虽然不是我想要的,但是还是谢谢热心帮忙
页:
[1]