Sign in to follow this  
Followers 0

Buttons and loops

3 posts in this topic

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


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

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


Share this post

Link to post
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
Sign in to follow this  
Followers 0