sendkeys.sendwait does not work


The .net command “System.Windows.Forms.SendKeys” works on all windows exept the main max window. I´m using max 2016 on Windows 7. I tried running max as anadministrator, but this didn´t help. Does anyone else have this problem?
That´s my code:

windows.sendMessage ((UIAccessor.GetChildWindows(windows.getMAXHWND()))[1]) 7 0 0		-- set an element of the maxwindow in focus, to make the max window the active application
    dnSendKeys = (dotNetClass "System.Windows.Forms.SendKeys")
    dnSendKeys.sendwait ("h")		-- press the button "h"
Is there a way to send keys to the main max window?