Jump to content

Recommended Posts

Posted

So I want to click this button once and after I click it the first time it will receive new properties, the first time It connects to the IP you put in input1 then the second time you press it, it will send what is in input1. But I failed and I'm lost.

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $IP, $TCPConnect, $i = 0

TCPStartup()

$Form1 = GUICreate("Client", 108, 23, 373, 441, -1, $WS_EX_TOPMOST)
$Input1 = GUICtrlCreateInput("0.0.0.0", 0, 0, 66, 21)
$Button1 = GUICtrlCreateButton("Connect", 72, 0, 35, 21)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            If $i = 0 Then
                $IP = GUICtrlRead($Input1)
                $TCPConnect = TCPConnect($IP, 5000)
                GUICtrlSetData($Button1, "Send")
            EndIf
            $i = 1
            If $i = 1 Then
                TCPSend($TCPConnect, GUICtrlRead($Input1))
                GUICtrlSetData($Input1, "")
            EndIf
    EndSwitch
WEnd

clientinput.au3

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
  • Recently Browsing   0 members

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