如何获取GUICtrlCreateMenuItem右键文本?在线等!
具体路思如图,在线等各位高手赐教,在这里先谢谢各位了#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("读取右键菜单文本", 372, 262, 352, 263)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
$ListView1 = GUICtrlCreateListView("读取右键菜单文本", 8, 16, 354, 238)
$NaMe = GUICtrlCreateContextMenu($ListView1)
$NaMe1 = GUICtrlCreateMenuItem("AU3程序交流",$NaMe)
GUICtrlSetOnEvent(-1,"_ReadItemNaMe")
GUICtrlCreateMenuItem("",$NaMe)
$NaMe2 = GUICtrlCreateMenuItem("AU3中文论坛",$NaMe)
GUICtrlSetOnEvent(-1,"_ReadItemNaMe")
GUICtrlCreateMenuItem("",$NaMe)
$NaMe3 = GUICtrlCreateMenuItem("AU3程序设计",$NaMe)
GUICtrlSetOnEvent(-1,"_ReadItemNaMe")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
Sleep(100)
WEnd
Func Form1Close()
Exit
EndFunc
Func _ReadItemNaMe()
MsgBox(0,"","将右键菜单的文本显示到这里")
EndFunc 对程序自身来说没有必要这样“获取”啊! #include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
;Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("读取右键菜单文本", 372, 262, 352, 263)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
$ListView1 = GUICtrlCreateListView("读取右键菜单文本", 8, 16, 354, 238)
$NaMe = GUICtrlCreateContextMenu($ListView1)
$NaMe1 = GUICtrlCreateMenuItem("AU3程序交流", $NaMe)
;GUICtrlSetOnEvent(-1, "_ReadItemNaMe")
GUICtrlCreateMenuItem("", $NaMe)
$NaMe2 = GUICtrlCreateMenuItem("AU3中文论坛", $NaMe)
;GUICtrlSetOnEvent(-1, "_ReadItemNaMe")
GUICtrlCreateMenuItem("", $NaMe)
$NaMe3 = GUICtrlCreateMenuItem("AU3程序设计", $NaMe)
;GUICtrlSetOnEvent(-1, "_ReadItemNaMe")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$msg = GUIGetMsg()
If $msg = $NaMe1 Or $msg = $NaMe2 Or $msg = $NaMe3 Then _ReadItemNaMe($msg)
If $msg = $GUI_EVENT_CLOSE Then Form1Close()
;Sleep(100)
WEnd
Func Form1Close()
Exit
EndFunc ;==>Form1Close
Func _ReadItemNaMe($ItemNaMe)
MsgBox(0, "", GUICtrlRead($ItemNaMe, 1))
EndFunc ;==>_ReadItemNaMe
Local $aItemText = ['AU3程序交流', 'AU3中文论坛', 'AU3程序设计']
GUICreate("读取右键菜单文本", 400, 300)
$ListView1 = GUICtrlCreateListView("读取右键菜单文本", 5, 5, 390, 280)
$NaMe = GUICtrlCreateContextMenu($ListView1)
$NaMe1 = GUICtrlCreateMenuItem($aItemText, $NaMe)
GUICtrlCreateMenuItem('', $NaMe)
$NaMe2 = GUICtrlCreateMenuItem($aItemText, $NaMe)
GUICtrlCreateMenuItem("", $NaMe)
$NaMe3 = GUICtrlCreateMenuItem($aItemText, $NaMe)
GUISetState()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $NaMe1 To $NaMe3
MsgBox(0, '', $aItemText[($nMsg - 5) / 2])
Case -3
Exit
EndSwitch
WEnd 回复 4# 水木子
谢谢,谢谢,目的是通过读取文本来实现。读取指定配置文件。 回复 3# _ddqs.
谢谢,谢谢! 顺便还请教个问题
用什么函数可以调整Excel的列宽,和高度? 回复 7# 19377708
http://www.autoitx.com/forum.php?mod=viewthread&tid=2176&extra=&page=1 谢谢,楼上的。
页:
[1]