netegg Posted September 30, 2009 Share Posted September 30, 2009 Does anyone have some ideas to increase the guiipaddress' fields from 4 to 6 for working with macaddress easylier? Link to comment Share on other sites More sharing options...
BugFix Posted October 6, 2009 Share Posted October 6, 2009 I've made an example for an MAC-input-control. expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) Global $aMAC $Form1 = GUICreate("Test") GUISetOnEvent(-3, 'Form1Close') $aMAC = _GuiCtrlCreateMAC(20, 20) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") While 1 Sleep(100) WEnd Func Form1Close() Exit EndFunc Func _GuiCtrlCreateMAC($iLeft, $iTop, $iWidth=185, $iHeight=21, $iBorder=1) Local $width = ($iWidth - 5*$iBorder)/6 Local $aInput[6], $x = $iLeft For $i = 0 To 5 $aInput[$i] = GUICtrlCreateInput('', $x, $iTop, $width, $iHeight, 1) $x += $width +$iBorder Next Return $aInput EndFunc Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) If BitShift($iwParam, 16) = 0x300 Then For $i = 0 To 5 If GUICtrlGetHandle($aMAC[$i]) = $ilParam Then If StringLen(GUICtrlRead($aMAC[$i])) = 2 Then If Not StringRegExp(GUICtrlRead($aMAC[$i]), '[a-fA-F0-9]{2}') Then GUICtrlSetData($aMAC[$i], '') Return $GUI_RUNDEFMSG EndIf If $i < 5 Then ControlFocus($hWnd, '', $aMAC[$i+1]) EndIf EndIf EndIf Next EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND Best Regards BugFix Link to comment Share on other sites More sharing options...
sandyd Posted October 7, 2009 Share Posted October 7, 2009 Small exmaple of how to get the Mac Address: Replace: Func Form1Close() Exit EndFunc With: Func Form1Close() Local $aMacAddress = '' for $i = 0 to UBound($aMAC)-1 $aMacAddress &= GuiCtrlRead($aMAC[$i]) Next MsgBox(0,'',$aMacAddress) Exit EndFunc ----[ SandyD ]--- Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now