搞定了,
界面用Koda拖拽控件 so easy,分分钟搞定
关键要 给tab的父窗口 发消息
_SendMessage发送$WM_NOTIFY消息给tab控件的父窗口
通知代码为$TCN_SELCHANGE
通知代码需要利用 结构体(sendmessage的第四个参数是结构体指针)
typedef struct tagNMHDR {
HWND hwndFrom;
UINT idFrom;
UINT code;
} NMHDR;
结构创建、设置结构值、得到结构指针 au3进程管理函数DllStruct****函数.....
sendmessage
#Include <GuiTab.au3>
#Include <SendMessage.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 432, 436, 192, 114)
$Checkbox1 = GUICtrlCreateCheckbox("第一页", 24, 16, 81, 25)
GUICtrlSetState($Checkbox1, $GUI_CHECKED)
$Checkbox2 = GUICtrlCreateCheckbox("第二页", 120, 16, 81, 25)
$Checkbox3 = GUICtrlCreateCheckbox("第三页", 200, 16, 81, 25)
$Tab1 = GUICtrlCreateTab(24, 56, 337, 337)
$TabSheet1 = GUICtrlCreateTabItem("第一页")
$Label1 = GUICtrlCreateLabel("Label1", 64, 112, 68, 18)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$Button1 = GUICtrlCreateButton("Button1", 176, 112, 65, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$TabSheet2 = GUICtrlCreateTabItem("第二页")
$Edit1 = GUICtrlCreateEdit("", 56, 128, 153, 177)
GUICtrlSetData(-1, "Edit1")
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$Button2 = GUICtrlCreateButton("Button2", 248, 184, 65, 33)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$TabSheet3 = GUICtrlCreateTabItem("第三页")
$Edit2 = GUICtrlCreateEdit("", 56, 136, 145, 169)
GUICtrlSetData(-1, "Edit2")
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$Radio1 = GUICtrlCreateRadio("Radio1", 232, 136, 73, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$Radio2 = GUICtrlCreateRadio("Radio2", 232, 184, 73, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$Button3 = GUICtrlCreateButton("Button3", 232, 232, 73, 33)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$tabHandle = GUICtrlGetHandle($Tab1)
$str = "long x;long y;long z"
$a = DllStructCreate($str)
DllStructSetData($a,1,$tabHandle )
DllStructSetData($a,2,$Tab1)
DllStructSetData($a,3,$TCN_SELCHANGE)
$p = DllStructGetPtr($a)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Checkbox1
GUICtrlSetState($Checkbox1, $GUI_CHECKED)
GUICtrlSetState($Checkbox2, $GUI_UNCHECKED)
GUICtrlSetState($Checkbox3, $GUI_UNCHECKED)
_GUICtrlTab_SetCurSel($tabHandle, 0)
_SendMessage($Form1, $WM_NOTIFY, $Tab1, $p)
Case $Checkbox2
GUICtrlSetState($Checkbox1, $GUI_UNCHECKED)
GUICtrlSetState($Checkbox2, $GUI_CHECKED)
GUICtrlSetState($Checkbox3, $GUI_UNCHECKED)
_GUICtrlTab_SetCurSel($tabHandle, 1)
_SendMessage($Form1, $WM_NOTIFY, $Tab1, $p)
Case $Checkbox3
GUICtrlSetState($Checkbox1, $GUI_UNCHECKED)
GUICtrlSetState($Checkbox2, $GUI_UNCHECKED)
GUICtrlSetState($Checkbox3, $GUI_CHECKED)
_GUICtrlTab_SetCurSel($tabHandle, 2)
_SendMessage($Form1, $WM_NOTIFY, $Tab1, $p)
EndSwitch
WEnd
|