I think I have it, can anyone tell me if this looks good, er, correct 
It works, it does exactly what i want it to do, allow hex input only basically (A-F,a-f, 0-9)
-------------
Scott Turchin

It works, it does exactly what i want it to do, allow hex input only basically (A-F,a-f, 0-9)
Code:
In WM_INITDIALOG of DialogProc ' Subclass the edit control Control Handle CbHndl, %IDTEXT1 To hEdit& gOldSubClassProc = SetWindowLong(hEdit&, %GWL_WNDPROC, CodePtr(SubClassProc)) '------------------------------------------------------------------------------- Function SubClassProc(ByVal hWnd&, ByVal wMsg&, ByVal wParam&, ByVal lParam&) As Long Local NewChar As Asciiz * 2 Local Y As Long Local zText As Asciiz * 13 Local yMsg As Long ' Process our messages in this subclass procedure Select Case wMsg& Case %WM_KEYDOWN Case %WM_KEYUP Case %WM_CHAR yMsg = LoWrd(wParam&) 'Actual ascii value of keystroke coming in If yMsg <> 8 And Len(St) = 12 Then Exit Function 'We don't want a MAC address longer than 12 Select Case yMsg Case 8 'BackSpace Case 48 To 57 '0-9 St = St + Chr$(yMsg) Case 65 To 70 'A-F St = St + Chr$(yMsg) Case 97 To 102 'a-f St = St + UCase$(Chr$(yMsg)) Case Else Exit Function End Select End Select ' Pass the message on to the original window procedure... the DDT engine! Function = CallWindowProc(gOldSubClassProc, hWnd&, wMsg&, wParam&, lParam&) End Function
Scott Turchin
Comment