试试这个:
#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <GUIListView.au3>
#include <array.au3>
$WinMain = GUICreate("主窗口", 410, 310) ;创建主窗口
$ListView1 = GUICtrlCreateListView("||", 8, 8, 400, 300)
For $I = 1 To 10
GUICtrlCreateListViewItem($I, $ListView1)
Next
$WinSub = GUICreate("商品查看 ", 415, 325 );创建子窗口
$Group1=GUICtrlCreateGroup("", 2, 0, 409, 321)
$Pic=GUICtrlCreatePic("", 4, 9, 404, 308)
GUICtrlSetImage(-1, @ScriptDir & "\IMAGE\商品\");& $JHLIST2[$JHLIST2[0] - 1])
$Group2=GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISwitch($WinMain) ;切换当前窗口到主窗口
GUISetState(@SW_SHOW,$WinMain)
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
While 1
$nMsg = GUIGetMsg(1)
Switch $nMsg[0]
Case $GUI_EVENT_CLOSE
Switch $nMsg[1]
Case $WinMain
Exit
Case $WinSub
GUISwitch($WinSub)
GUISetState(@SW_HIDE)
EndSwitch
EndSwitch
WEnd
Func WM_NOTIFY($hWndGUI, $MsgID, $WParam, $LParam)
Local $tagNMHDR, $Event, $hWndFrom, $IDFrom
Local $tagNMHDR = DllStructCreate("int;int;int", $LParam)
If @error Then Return $GUI_RUNDEFMSG
$IDFrom = DllStructGetData($tagNMHDR, 2)
$Event = DllStructGetData($tagNMHDR, 3)
$tagNMHDR = 0
Switch $IDFrom
Case $ListView1
Switch $Event
Case $NM_DBLCLK ; 双击
$JHLIST1 = GUICtrlRead(GUICtrlRead($ListView1))
If $JHLIST1 = 0 Then Return
$JHLIST2 = StringSplit($JHLIST1, "|", 1)
GUISwitch($WinSub)
GUISetState(@SW_SHOW)
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY
|