Jump to content

Problem with UDF tabs!


Glyph
 Share

Recommended Posts

$tab = _GUICtrlTab_Create($GUI, 0, 0, $guiw, $guih)
_GUICtrlTab_SetExtendedStyle($tab, BitOR($TCS_BUTTONS, $TCS_HOTTRACK, $TCS_FLATBUTTONS, $WS_EX_TRANSPARENT))

$tab1 = _GUICtrlTab_InsertItem($Tab, 0, "1")
GUICtrlCreateLabel("ID:", 0, 30, 35, 20)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKSIZE)
$user = GUICtrlCreateInput("", 55, 30, 100, 20)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKSIZE)

$tab2 = _GUICtrlTab_InsertItem($Tab, 1, "2")
GUICtrlCreateLabel("ID2:", 0, 30, 35, 20)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKSIZE)
$user = GUICtrlCreateInput("", 55, 30, 100, 20)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKSIZE)

$tab3 = _GUICtrlTab_InsertItem($Tab, 2, "3")
GUICtrlCreateLabel("ID3:", 0, 30, 35, 20)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKSIZE)
$user = GUICtrlCreateInput("", 55, 30, 100, 20)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKSIZE)

these will overlap, i've already tried GUICtrlCreateTabItem("") to try to prevent this, and it won't work!

also tried searching forums for this problem, everyones tab problems deal with the non udf version...

please help!!

Edited by BackStabbed

tolle indicium

Link to comment
Share on other sites

#Include <GuiTab.au3>
#include <GUIConstants.au3>
#include <GuiEdit.au3>
#include <Inet.au3>
#include <GuiListView.au3>
#include <Process.au3>
#include <File.au3>
#include <WindowsConstants.au3>
#include <TabConstants.au3>
#include <ListviewConstants.au3>
#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <StaticConstants.au3>
#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <GuiMenu.au3>
#include <GuiImageList.au3>

Global $PublicIP = _GetIP()
If $PublicIP = "-1" Then
    $PublicIP = @IPAddress1
EndIf

$ver = "v3.12"
$named = "Default " & $ver & " | By: Glyph"
$guiw = "776"
$guih = "194"
Global Enum $idOpen = 1000, $idSave, $idInfo
    
Global $Port = IniRead("untitled.db", "Server", "Port", "63336")
Global $MaxConc = 1001;always +1 from the total wanted.
Global Const $MaxConnection = ($MaxConc - 1)
Global $MainSocket = TCPStartServer($Port, $MaxConc)
If @error <> 0 Then Exit MsgBox(16, "Error", "Server unable to initialize.")
Global Const $MaxLength = 2048
Global $Users = 0
$msg = 0
Global $ConnectedSocket[$MaxConc][7]

Global $CurrentSocket = 0

For $Track = 0 To $MaxConnection Step 1
    $ConnectedSocket[$Track][0] = -1
    $ConnectedSocket[$Track][1] = -1
Next

$gui = GUICreate($named, $guiw, $guih, @DesktopWidth / 6, @DesktopHeight / 3, $WS_SIZEBOX)
Local $aText[3] = ["Ready", @TAB & "Port: " & $Port, @TAB & @TAB & "Connection(s): " & $Users & "     "]
Local $aParts[3] = [100, 175, -1]
$hStatus = _GUICtrlStatusBar_Create($gui, $aParts, $aText)

GUIRegisterMsg($WM_SIZE, "WM_SIZE")
GUISetBkColor("0xff0000")
;$Tab = _GUICtrlTab_Create($GUI, 0, 0, 400, 255)
$tab = _GUICtrlTab_Create($GUI, 0, 0, $guiw, $guih)
_GUICtrlTab_SetExtendedStyle($tab, BitOR($TCS_BUTTONS, $TCS_HOTTRACK, $TCS_FLATBUTTONS, $WS_EX_TRANSPARENT))
;GUICtrlSetState(-1,$gui_disable)

$tab2 = _GUICtrlTab_InsertItem($Tab, 0, "Connections")
GUICtrlCreateLabel("ID:", 0, 30, 35, 20)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKSIZE)
$user = GUICtrlCreateInput("", 55, 30, 100, 20)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKSIZE)
GUICtrlCreateLabel("Command:", 0, 55, 60, 20)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKSIZE)
$command = GUICtrlCreateInput("", 55, 55, 145, 20)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKSIZE)
$blast = GUICtrlCreateButton("Send", 75, $guih-75, 50, 20)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKSIZE)
$roar = GUICtrlCreateButton("Tray", $guiw - $guiw+75, $guih - 100, 50, 20)
GUICtrlSetResizing(-1, $GUI_DOCKleft + $GUI_DOCKSIZE)

;LISTVIEW--================================================
;LISTVIEW--================================================
;LISTVIEW--================================================
;LISTVIEW--================================================
$listview = _GUICtrlListView_Create($gui, "",210, 30, $guiw - 215, $guih - 75);,$LVS_SORTDESCENDING)
_GUICtrlListView_SetExtendedListViewStyle($LISTVIEW,BitOR($LVS_EX_DOUBLEBUFFER, $LVS_EX_GRIDLINES))
; Add columns
_GUICtrlListView_InsertColumn($ListView, 0, "ID", 100)
_GUICtrlListView_InsertColumn($ListView, 1, "User", 100)

    ; Add items
    _GUICtrlListView_InsertItem($ListView, "Item 1", 0)
    _GUICtrlListView_InsertItem($ListView, "Item 2", 1)
    _GUICtrlListView_InsertItem($ListView, "Item 3", 1)
;LISTVIEW--================================================
;LISTVIEW--================================================
;LISTVIEW--================================================
;LISTVIEW--================================================

GUICtrlSetResizing(-1, $GUI_DOCKBORDERS)
GUICtrlCreateLabel(" ", 255, 65, 2, 225)
GUICtrlSetColor(-1, 0x000000)
GUICtrlSetColor(-1, 0x000000)
$setstab=_GUICtrlTab_InsertItem($Tab, 1, "Settings")
GUICtrlCreateLabel("Port:", 0, 30, 55, 20)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKSIZE)
$comport = GUICtrlCreateInput(IniRead("Default.db", "Server", "Port", "63336"), 55, 30, 50, 20, $ES_NUMBER)
GUICtrlSetLimit(-1, 5)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKSIZE)

$wtfport = GUICtrlCreateButton("?", 107, 30, 15, 20)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKSIZE)
GUICtrlCreateLabel("Password:", 0, 55, 55, 20)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKSIZE)
$serverpass = GUICtrlCreateInput(IniRead("Default.db", "Server", "Password", "pass"), 55, 55, 100, 20)
GUICtrlSetLimit(-1, 5)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKSIZE)
$btips = GUICtrlCreateCheckbox("Baloon tips", 0, 80, 75, 20)
GUICtrlSetState(-1, $GUI_CHECKED)

$savesets = GUICtrlCreateButton("Apply/Save", $guiw - 85, $guih - 75, 70, 20)
GUICtrlSetResizing(-1, $GUI_DOCKright + $GUI_DOCKSIZE)
GUICtrlCreateTabItem("")

$logtab = _GUICtrlTab_InsertItem($Tab, 2, "History")
;GUICtrlCreateTabItem("History")
$logedit = GUICtrlCreateEdit("" & @CRLF, 0, 30, $guiw - 5, $guih - 75, BitOR($ES_READONLY, $ES_AUTOVSCROLL, $ES_MULTILINE, $WS_VSCROLL))
GUICtrlSetResizing(-1, $GUI_DOCKBORDERS)

GUICtrlCreateTabItem("")
$misctab = _GUICtrlTab_InsertItem($Tab, 3, "About")
;GUICtrlCreateTabItem("About")

GUICtrlCreateEdit("Default Credits: Glyph", 0, 30, $guiw - 5, $guih - 75, BitOR($ES_READONLY, $ES_AUTOVSCROLL, $ES_MULTILINE, $ES_CENTER))
GUICtrlSetResizing(-1, $GUI_DOCKBORDERS)


#cs
If $PublicIP = "127.0.0.1" Then
    $publicurl = "127.0.0.1"
    GUICtrlSetData($routerz, "(You are not connected to the internet?)")
ElseIf $octet[1] = "192" And $octet[2] = "168" Then
    $publicurl = $PublicIP
    GUICtrlSetData($routerz, "(You are not connected to the internet?)")
Else
    $publicurl = $PublicIP
EndIf
#ce


GUISetState(@SW_SHOW, $gui)
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
While 1
    $msg2 = TrayGetMsg()
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then
        $Sizwe = WinGetClientSize($gui, "")
        IniWrite("Default.db", "Server", "Width", $Sizwe[0] + 2)
        IniWrite("Default.db", "Server", "Height", $Sizwe[1] + 21)
        Exit
    EndIf
    
    $ConnectedSocket[$CurrentSocket][0] = TCPAccept($MainSocket)
    If $ConnectedSocket[$CurrentSocket][0] <> -1 Then
        $CurrentSocket = SocketSearch()
    EndIf
    
    For $Track = 0 To $MaxConnection Step 1
        If $ConnectedSocket[$Track][0] <> -1 Then
            $Data = TCPRecv($ConnectedSocket[$Track][0], $MaxLength)
            
            If @error Then
                
                If $ConnectedSocket[$Track][1] <> "-1" Then
                    $aye = _GUICtrlListView_FindText($listview, $ConnectedSocket[$Track][1], -1, False, False)
                    _GUICtrlListView_DeleteItem(GUICtrlGetHandle($listview), $aye)
                    
                    _GUICtrlEdit_AppendText($logedit, "[" & @HOUR & ":" & @MIN & ":" & @SEC & "] User dropped: " & $ConnectedSocket[$Track][1] & @CRLF)
                    
                    If BitAND(GUICtrlRead($btips), $GUI_CHECKED) = $GUI_CHECKED Then
                        TrayTip("Default " & $ver, $ConnectedSocket[$Track][1] & " has dropped!" & ".", 5, 1)
                    EndIf
                    
                    $Users -= 1
                    _GUICtrlStatusBar_SetText($hStatus, @TAB & @TAB & "Connection(s): " & $Users & "     ", 2)
                EndIf
                
                TCPCloseSocket($ConnectedSocket[$Track][0])
                $ConnectedSocket[$Track][0] = -1
                $ConnectedSocket[$Track][1] = -1
                $ConnectedSocket[$Track][2] = "-1"
                $CurrentSocket = SocketSearch()
                
            EndIf
            
            $splitdata = StringSplit($Data, Chr(1))
            $ipz = SocketToIP($ConnectedSocket[$Track][0])

            If IniRead("Default.DB", "IPBans", $ipz, "0") = 0 Then
                ;If $Data <> "" Then
                ;   append("--> " & $splitdata[0] & " - ", $Data)
                ;EndIf
                If $splitdata[0] = "2" Then
                    
                    If $splitdata[1] = "logout" Then
                        If $ConnectedSocket[$Track][0] <> "-1" And $ConnectedSocket[$Track][1] = $splitdata[2] Then
                            $ConnectedSocket[$Track][1] = "-1"
                            $ConnectedSocket[$Track][2] = "-1"
                            $aye = _GUICtrlListView_FindText($listview, $splitdata[2], -1, False, False)
                            _GUICtrlListView_DeleteItem(GUICtrlGetHandle($listview), $aye)
                            _GUICtrlEdit_AppendText($logedit, "[" & @HOUR & ":" & @MIN & ":" & @SEC & "] User logout: " & $splitdata[2] & @CRLF)
                            If BitAND(GUICtrlRead($btips), $GUI_CHECKED) = $GUI_CHECKED Then
                                TrayTip("Default " & $ver, $splitdata[2] & " has logged out from " & $ipz & ".", 5, 1)
                            EndIf
                            $Users -= 1
                            _GUICtrlStatusBar_SetText($hStatus, @TAB & @TAB & "Connection(s): " & $Users & "     ", 2)
                            
                        EndIf
                    EndIf
                EndIf
                
                If $splitdata[0] = "10" Then
                    If $splitdata[1] = "login" Then
                        If $ConnectedSocket[$Track][0] <> "-1" Then
                            For $t = 0 To $MaxConnection
                                If $ConnectedSocket[$t][1] = $splitdata[2] Or $ConnectedSocket[$t][2] = $ipz Then
                                    ;duplicates
                                    _GUICtrlEdit_AppendText($logedit, "[" & @HOUR & ":" & @MIN & ":" & @SEC & "] Duplicate attempted to login from " & $ipz & "!" & @CRLF)
                                    TCPSend($ConnectedSocket[$Track][0], "gtfo")
                                    ExitLoop
                                Else
                                    $ConnectedSocket[$Track][2] = $ipz
                                    $passwordz = IniRead("Default.DB", "Server", "Password", Chr(4) & Chr(20))
                                    If $passwordz = $splitdata[3] And IniRead("Default.DB", $splitdata[2], "Banned", "0") = "0" Then
                                        IniWrite("Default.DB", $splitdata[2], "LastIP", $ipz)
                                        IniWrite("Default.DB", "IPBans", $ipz, "0")
                                        $Users += 1
                                        _GUICtrlListView_AddItem($listview, $splitdata[2], 0);ID
                                        $ConnectedSocket[$Track][1] = $splitdata[2]
                                        _GUICtrlListView_AddSubItem($listview, $Users - 1, $splitdata[4], 1, 1)
                                        _GUICtrlListView_AddSubItem($listview, $Users - 1, $splitdata[5], 2, 1)
                                        _GUICtrlListView_AddSubItem($listview, $Users - 1, $splitdata[6], 3, 1)
                                        _GUICtrlListView_AddSubItem($listview, $Users - 1, $splitdata[7], 4, 1)
                                        _GUICtrlListView_AddSubItem($listview, $Users - 1, $splitdata[8], 5, 1)
                                        _GUICtrlListView_AddSubItem($listview, $Users - 1, $splitdata[9], 6, 1);ver
                                        _GUICtrlListView_AddSubItem($listview, $Users - 1, $splitdata[10], 7, 1);ping
                                        _GUICtrlEdit_AppendText($logedit, "[" & @HOUR & ":" & @MIN & ":" & @SEC & "] User login: " & $splitdata[2] & "|" & $splitdata[3] & "|" & $splitdata[4] & "|" & $splitdata[5] & "|" & $splitdata[6] & "|" & $splitdata[7] & _
                                                "|" & $splitdata[8] & "|" & $splitdata[9] & @CRLF)
                                        If BitAND(GUICtrlRead($btips), $GUI_CHECKED) = $GUI_CHECKED Then
                                            TrayTip("Default " & $ver, $splitdata[2] & " has logged in from " & $ipz & ".", 5, 1)
                                        EndIf
                                        _GUICtrlStatusBar_SetText($hStatus, @TAB & @TAB & "Connection(s): " & $Users & "     ", 2)
                                        ExitLoop
                                    EndIf
                                EndIf
                            Next
                        EndIf
                    EndIf
                EndIf
                
            EndIf
        EndIf
    Next
WEnd

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iMsg, $iwParam
    Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo
;~  Local $tBuffer
    $hWndListView = $listview;Add the listview's handle here
    If Not IsHWnd($ListView) Then $hWndListView = GUICtrlGetHandle($ListView)

    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    Switch $hWndFrom
        Case $hWndListView
            Switch $iCode
                Case $NM_RCLICK ; Sent by a list-view control when the user clicks an item with the right mouse button
                    $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
                    ;msgbox(0,"Index of "&_GUICtrlListView_GetItemText($listview, DllStructGetData($tInfo, "Index")),"Ping/TracerT/CMD terminal/keylogview/commandlist/help")
                          ListView_RClick()
                    ;Return 1 ; not to allow the default processing
                    Return 0 ; allow the default processing
                    ; No return value
                    Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button
                    $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
                        guictrlsetdata($user,_GUICtrlListView_GetItemText($listview, DllStructGetData($tInfo, "Index")))
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_NOTIFY

Func ListView_RClick()
    Local $aHit
    $aHit = _GUICtrlListView_SubItemHitTest($ListView)
    If ($aHit[0] <> -1) Then
        ; Create a standard popup menu
        ; -------------------- To Do --------------------
        $hMenu = _GUICtrlMenu_CreatePopup()
        _GUICtrlMenu_AddMenuItem($hMenu, "Open", $idOpen)
        _GUICtrlMenu_AddMenuItem($hMenu, "Save", $idSave)
        _GUICtrlMenu_AddMenuItem($hMenu, "Info", $idInfo)
        ; ========================================================================
        ; Shows how to capture the context menu selections
        ; ========================================================================
        Switch _GUICtrlMenu_TrackPopupMenu($hMenu, $ListView, -1, -1, 1, 1, 2)
            Case $idOpen
                _DebugPrint("Open: " & StringFormat("Item, SubItem [%d, %d]", $aHit[0], $aHit[1]))
            Case $idSave
                _DebugPrint("Save: " & StringFormat("Item, SubItem [%d, %d]", $aHit[0], $aHit[1]))
            Case $idInfo
                _DebugPrint("Info: " & StringFormat("Item, SubItem [%d, %d]", $aHit[0], $aHit[1]))
        EndSwitch
        _GUICtrlMenu_DestroyMenu($hMenu)
    EndIf
EndFunc   ;==>ListView_RClick

Func SocketSearch()
    Local $Track = 0
    For $Track = 0 To $MaxConnection Step 1
        If $ConnectedSocket[$Track][0] = -1 Then
            Return $Track
        Else
            ; Socket In Use
        EndIf
    Next
EndFunc   ;==>SocketSearch

; Function to return IP Address from a connected socket.
;----------------------------------------------------------------------
Func SocketToIP($SHOCKET)
    Local $sockaddr = DllStructCreate("short;ushort;uint;char[8]")

    Local $aRet = DllCall("Ws2_32.dll", "int", "getpeername", "int", $SHOCKET, _
            "ptr", DllStructGetPtr($sockaddr), "int*", DllStructGetSize($sockaddr))
    If Not @error And $aRet[0] = 0 Then
        $aRet = DllCall("Ws2_32.dll", "str", "inet_ntoa", "int", DllStructGetData($sockaddr, 3))
        If Not @error Then $aRet = $aRet[0]
    Else
        $aRet = 0
    EndIf

    $sockaddr = 0

    Return $aRet
EndFunc   ;==>SocketToIP

Func TCPStartServer($Port, $MaxConnect = 1)
    Local $Socket
    $Socket = TCPStartup()
    Select
        Case $Socket = 0
            SetError(@error)
            Return -1
    EndSelect
    $Socket = TCPListen(@IPAddress1, $Port, $MaxConnect)
    Select
        Case $Socket = -1
            SetError(@error)
            Return 0
    EndSelect
    SetError(0)
    Return $Socket
EndFunc   ;==>TCPStartServer

; Resize the status bar when GUI size changes
Func WM_SIZE($hWnd, $iMsg, $iwParam, $ilParam)
    _GUICtrlStatusBar_Resize($hStatus)
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_SIZE

Func OnAutoItExit()
EndFunc   ;==>OnAutoItExit

Func _DebugPrint($s_text, $line = @ScriptLineNumber)
    ConsoleWrite( _
            "!===========================================================" & @LF & _
            "+======================================================" & @LF & _
            "-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _
            "+======================================================" & @LF)
EndFunc   ;==>_DebugPrint

I would like to add that I greatly appreciate anyones help!!

tolle indicium

Link to comment
Share on other sites

Alright, so I got every other control to hide/show except for the UDF listview control....

the guictrlsetstate is not working on this??

is there a command i'm missing in the helpfile??

setextended looked most relevent, but none of those params hide the control...

This is almost what i want!!

http://www.autoitscript.com/forum/index.ph...l=hide+listview

but, I need to hide the whole control!

Edited by BackStabbed

tolle indicium

Link to comment
Share on other sites

You shoukd work with

WinSetState($listview,"",@SW_HIDE)

WinSetState($listview,"",@SW_SHOW)

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...