0

このコード ウィッチは IP の公開情報を取得することがわかりましたが、この出力を、Gui の EditBox に書き込む必要があります。

これを行う方法。

これは、SCITE エディターで実行すると、情報が SCIITE のコンソールに表示されるコードです。私が欲しいのは、ボタンをクリックして情報を GUI の編集ボックスに入れることです。

    _RetrievePublicInfo()

Func _RetrievePublicInfo($iRefresh = 0)
    ConsoleWrite(@CRLF & "IP: " & BinaryToString(InetRead('http://api.externalip.net/ip/', $iRefresh), 4) & @CRLF & @CRLF & _
    "Hostname: " & BinaryToString(InetRead('http://api.externalip.net/hostname/', $iRefresh), 4) & @CRLF)
EndFunc
4

2 に答える 2

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

Func _RetrievePublicInfo($iRefresh = 0)
   GUICtrlSetData($Edit , @CRLF & "IP: " &    BinaryToString(InetRead('http://api.externalip.net/ip/', $iRefresh), 4) & @CRLF & @CRLF & _
"Hostname: " & BinaryToString(InetRead('http://api.externalip.net/hostname/', $iRefresh), 4) & @CRLF)
EndFunc



$hGUI = GUICreate("Test", 370, 240, 192, 124)
$Edit = GUICtrlCreateEdit("", 0, 0, 313, 193, BitOR($GUI_SS_DEFAULT_EDIT,$ES_READONLY))
$button = GUICtrlCreateButton("Get ip",310,180,50,30)

GUISetState(@SW_SHOW)


While 1
   $nMsg = GUIGetMsg()
   Switch $nMsg
  Case $button
    _RetrievePublicInfo()
      Case $GUI_EVENT_CLOSE
        Exit
      Case $Edit
   EndSwitch
WEnd
于 2013-02-06T00:36:00.593 に答える