A right click does not fire a $WM_COMMAND event. But it does fire a $WM_CONTEXTMENU event. Just add this code: GUIRegisterMsg($WM_CONTEXTMENU, "WM_CONTEXTMENU")
...
...
Func WM_CONTEXTMENU($hWnd, $iMsg, $wParam, $lParam)
ConsoleWrite( "WM_CONTEXTMENU" & @CRLF )
ConsoleWrite( "$wParam = " & $wParam & @CRLF )
EndFunc