#include <GUIConstants.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
$skin = "D:\公共\au3\Au3皮肤\Skin\Gloss_ST.skf"
$SkinDll = "D:\公共\au3\Au3皮肤\Skin\SkinCrafterDll.dll"
Func _SkinGUI($SkincrafterDll, $SkincrafterSkin, $Handle)
$Dll = DllOpen($SkincrafterDll)
DllCall($Dll, "int:cdecl", "InitLicenKeys", "wstr", "1", "wstr", "", "wstr", "1@1.com", "wstr", "1")
DllCall($Dll, "int:cdecl", "InitDecoration", "int", 1)
DllCall($Dll, "int:cdecl", "LoadSkinFromFile", "wstr", $SkincrafterSkin)
DllCall($Dll, "int:cdecl", "DecorateAs", "int", $Handle, "int", 25)
DllCall($Dll, "int:cdecl", "ApplySkin")
EndFunc ;==>_SkinGUI
$RootWindows = GUICreate("Server -- TCP Talke Server", @DesktopWidth * 0.6, @DesktopHeight * 0.6, @DesktopWidth * 0.2, @DesktopHeight * 0.2)
_SkinGUI($SkinDll, $skin, $RootWindows)
;========================================================================================
; 各控件边界设置
;tab签
$tab_lf = 8
$tab_tp = 10
$tab_wd = @DesktopWidth * 0.6 - 20
$tab_ht = @DesktopHeight * 0.6 - 50
$tab_sty = ""
;接收栏
$RvEdit_lf = 11
$RvEdit_tp = 30
$RvEdit_wd = @DesktopWidth * 0.6 - 26
$RvEdit_ht = @DesktopHeight * 0.6 - 220
$RvEdit_sty = BitOR($ES_MULTILINE, $ES_AUTOVSCROLL, $ES_WANTRETURN, $ES_READONLY, $ws_VSCROLL)
;IP地址
$Ipedit_tp = @DesktopHeight * 0.6 - 180
$Ipedit_lf = 40
$Ipedit_sty = $ES_NUMBER
;发送栏
$SdEdit_tp = @DesktopHeight * 0.6 - 150
$SdEdit_lf = 11
$SdEdit_wd = @DesktopWidth * 0.6 - 26
$SdEdit_ht = 50
$SdEdit_sty = BitOR($ES_MULTILINE, $ES_AUTOVSCROLL, $ES_WANTRETURN, $ws_VSCROLL)
;按钮
$Bu_sd_tp = $SdEdit_tp + $SdEdit_ht + 10
$Bu_sd_lf = @DesktopWidth * 0.15 - 10
$Bu_ext_lf = @DesktopWidth * 0.45 - 150
;
;
;========================================================================================
$tab = GUICtrlCreateTab($tab_lf, $tab_tp, $tab_wd, $tab_ht, $tab_sty) ;创建TAB标签
$tb_Rs = GUICtrlCreateTabItem(" 收发信息 ") ; 收发 tab 标签
$RvEdit = GUICtrlCreateEdit("", $RvEdit_lf, $RvEdit_tp, $RvEdit_wd, $RvEdit_ht, $RvEdit_sty) ; 接收栏
$SdEdit = GUICtrlCreateEdit("", $SdEdit_lf, $SdEdit_tp, $SdEdit_wd, $SdEdit_ht, $SdEdit_sty) ; 发送栏
$Bu_sd = GUICtrlCreateButton("发送[&Enter]", $Bu_sd_lf, $Bu_sd_tp, 113, 25, 0)
$Bu_ext = GUICtrlCreateButton("退出[&Esc]", $Bu_ext_lf, $Bu_sd_tp, 113, 25, 0)
; tab 1
;---------------------------------------------------------------------------
$tb_cl = GUICtrlCreateTabItem(" 客户端 ")
$Bu_ext_cl = GUICtrlCreateButton("退出[&Esc]", $Bu_ext_lf, $Bu_sd_tp, 113, 25, 0)
GUICtrlCreateTabItem("") ; TAB 标签结束
GUICtrlSetState($tb_Rs, $GUI_SHOW)
GUISetState(@SW_SHOW)
GUICtrlSetState($RvEdit, $GUI_FOCUS)
GUICtrlSetState($SdEdit, $GUI_FOCUS)
GUIRegisterMsg($WM_SETFOCUS, "MSG_WM_SETFOCUS")
While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then ExitLoop
If $msg = $tab Then tabhide()
WEnd
Func tabhide()
Switch GUICtrlRead($tab, 1)
Case $tb_Rs
GUICtrlSetState($RvEdit, $GUI_SHOW + $GUI_ENABLE + $GUI_FOCUS)
GUICtrlSetState($SdEdit, $GUI_SHOW + $GUI_ENABLE + $GUI_FOCUS)
Case $tb_cl
Case Else
Return
EndSwitch
EndFunc ;==>tabhide
Func MSG_WM_SETFOCUS($hWnd, $msg, $wParam, $lParam)
Local $sel_tab = GUICtrlRead($tab, 1)
If $sel_tab <> $tb_Rs And ($wParam = GUICtrlGetHandle($SdEdit) Or $wParam = GUICtrlGetHandle($RvEdit)) Then
ControlFocus ($RootWindows,"",$sel_tab)
GUICtrlSetState($sel_tab, $GUI_SHOW + $GUI_FOCUS)
EndIf
Return $GUI_RUNDEFMSG
EndFunc ;==>MSG_WM_SETFOCUS