cm84n7281 发表于 2016-7-28 10:24:22

我需要完成如下截图中的功能,不知道代码如何写

我有一个代码是截图所示的,不知道如何实现。

ap112 发表于 2016-7-28 10:25:58

GUICtrlCreateGroup
--------------------------------------------------------------------------------

Creates a Group control for the GUI.


GUICtrlCreateGroup ( "text", left, top [, width [, height [, style [, exStyle]]]] )




Parameters

text The text of the control.
left The left side of the control. If -1 is used then left will be computed according to GUICoordMode.
top The top of the control. If -1 is used then top will be computed according to GUICoordMode.
width The width of the control (default is the previously used width).
height The height of the control (default is the previously used height).
style Defines the style of the control. See GUI Control Styles Appendix.
default ( -1) : none.
forced styles : $WS_GROUP, $BS_GROUPBOX.
exStyle Defines the extended style of the control. See Extended Style Table.



Return Value

Success: Returns the identifier (controlID) of the new control.
Failure: Returns 0.



Remarks

A group control is the thin line you see around controls (usually only Radio button) that visually groups them together. Only one Radio button within a Group can be selected at once.
If you want to have multiple groups without the visible line then you must use GUIStartGroup() to group your Radio buttons.

To use the values specified above you must #include <ButtonConstants.au3> in your script.

Default resizing is $GUI_DOCKAUTO size and position will occur.

ffcloudy 发表于 2016-7-28 11:27:10

include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <ACN_NET.au3>
#include <Inet.au3>
    Local $msg
    Dim $net
    GUICreate("My GUI") ;
    GUISetState(@SW_SHOW) ;
        GUICtrlCreateGroup("信息区",10,100,300,200)
       
        GUICtrlCreateLabel("IP地址:",20,120,-1,-1)
   $hIP_Input = GUICtrlCreateInput(" ", 120, 120, 150, -1)
    GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
        GUICtrlSetData($hIP_Input, @IPAddress1)
        GUICtrlCreateLabel("子网掩码:",20,140,-1,-1)
        $net_Input =GUICtrlCreateInput(" ", 120, 140, 150, -1)
        net()
        GUICtrlSetData($net_Input,$net)
        GUICtrlCreateLabel("默认网关:",20,160,-1,-1)
        $hmask_Input = GUICtrlCreateInput(" ", 120, 160, 150, -1)
        GUICtrlSetData($hmask_Input, _Gateway())
       
        GUICtrlCreateLabel("MAC地址:",20,180,-1,-1)
        $hmac_Input = GUICtrlCreateInput("",120,180,150,-1)
        GUICtrlSetData($hmac_Input,_API_Get_NetworkAdapterMAC(@IPAddress1))
        GUICtrlCreateLabel("公网IP地址:",20,200,-1,-1)
        $pip_Input = GUICtrlCreateInput("",120,200,150,-1)
        GUICtrlSetData($pip_Input,public_ip())
    While 1
      $msg = GUIGetMsg()

      If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
    GUIDelete()

Func _Gateway()
      Dim $IPGateway
      Dim $objWMIService = ObjGet("winmgmts:\\.\root\CIMV2")
      Dim $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = TRUE", "WQL", 0x10 + 0x20)
      For $objItem In $colItems
                $IPGateway = $objItem.DefaultIPGateway(0)
                If StringInStr($IPGateway, ".") > 0 Then ExitLoop
      Next
      Return StringRegExpReplace($IPGateway, '(\d+\.){12}', '')
        EndFunc   ;==>_Gateway
       
Func public_ip()
      Local $source = _INetGetSource("http://ip.qq.com")
      Local $aIP = StringRegExp($source, '您当前的IP为.*?(\d[\d.]+)', 3, 1)
      If Not @error Then
                Return $aIP
      Else
                Return 0
      EndIf
        EndFunc   

Func net()
      
Dim $objWMIService = ObjGet("winmgmts:\\.\root\CIMV2")
Dim $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = TRUE", "WQL", 0x10 + 0x20)
For $objItem In $colItems
$net =$objItem.IPSubnet(0)
Next
   
EndFunc   ;==>_Gateway

cm84n7281 发表于 2016-7-28 15:43:17

@ffcloudy
你的代码,我测试了,有如下错误。! 截图如下

cm84n7281 发表于 2016-7-28 15:45:55

@ffcloudy
你的代码,我测试了,有如下错误。! 截图如下

ffcloudy 发表于 2016-7-28 18:13:04

回复 5# cm84n7281


看看自己有没有ACN_NET.au3函数吧

d494031732 发表于 2016-8-3 13:53:16

好熟悉的界面。哈哈 。njsf的人?新手的话建议你先吧界面画出来,然后单独msgbox 测试把想要的信息取出来,最后合并就好啦。

wymjeef 发表于 2016-8-11 11:29:13

不是很明白你的意思
页: [1]
查看完整版本: 我需要完成如下截图中的功能,不知道代码如何写