The explanations are much more complicated than the code. Here's the code: #include <GUIConstants.au3>
#include <WinAPIShellEx.au3>
#include <GuiEdit.au3>
Opt( "MustDeclareVars", 1 )
Example()
Func Example()
Local $hGui = GUICreate( "Input (numbers only)", 300, 118 )
Local $idInput = GUICtrlCreateInput( "", 50, 50, 200, 18, $GUI_SS_DEFAULT_INPUT+$ES_NUMBER )
Local $hInput = GUICtrlGetHandle( $idInput )
GUICtrlCreateLabel( "No context menu, no paste, no balloontip", 50, 70, 200, 18 )
; Register callback function to subclass Input control
Local $pInputProc = DllCallbackGetPtr( DllCallbackRegister( "InputProc", "lresult", "hwnd;uint;wparam;lparam;uint_ptr;dword_ptr" ) )
_WinAPI_SetWindowSubclass( $hInput, $pInputProc, 9999, 0 ) ; SubclassId = 9999, $pData = 0
GUISetState()
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
; Cleanup
_WinAPI_RemoveWindowSubclass( $hInput, $pInputProc, 9999 )
GUIDelete( $hGui )
Exit
EndFunc
; InputProc callback function
Func InputProc( $hWnd, $iMsg, $wParam, $lParam, $iSubclassId, $pData )
Switch $iMsg
Case $WM_CONTEXTMENU, $WM_PASTE, $EM_SHOWBALLOONTIP
Return 0
EndSwitch
; Call next function in subclass chain
Return DllCall( "comctl32.dll", "lresult", "DefSubclassProc", "hwnd", $hWnd, "uint", $iMsg, "wparam", $wParam, "lparam", $lParam )[0] ; _WinAPI_DefSubclassProc
EndFunc