locked
Win 7 and SendKeys RRS feed

  • Question

  • Hello All,

    SendKeys has always worked in my apps until loaded on a Win7 64 bit machine, it's overridden by the machines security.  I have configured the Seccurity/Administrative tools every possible way using the Net Framework 1.1 Utilities.  Even though I have been sucsessful in giving the exe and complete assembly full trust it makes no difference, I still get a security exception when calling SendKeys.

    What am I missing?  Thanks to all,


    Nitromuse
    Thursday, December 9, 2010 6:55 PM

All replies

  • Hi Nitromuse,

    May I know the exception message? as well as the call stack?


    Eric Yang [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, December 10, 2010 2:46 AM
  • Thanks Eric,

    System.Security.SecurityException: Unable to create Hook.
       at System.Windows.Forms.SendKeys.InstallHook()
       at System.Windows.Forms.SendKeys.Send(String keys, Control control, Boolean wait)
       at System.Windows.Forms.SendKeys.SendWait(String keys, Control control)
       at System.Windows.Forms.SendKeys.SendWait(String keys)
       at Pay.TimeForm.TimeForm_Cancel(Object sender, CancelEventArgs e) in C:\PayDir\Pay\TimeForm.vb:line 196
       at System.Windows.Forms.Form.OnClosing(CancelEventArgs e)
       at System.Windows.Forms.Form.CheckCloseDialog()

     

    there are no listings in the Call Stack

    Thank you,


    Nitromuse
    Friday, December 10, 2010 1:52 PM
  • Hi Nitromuse,

    Could you please try to run your application as administrator, by right-clicking the executable, select "run as administrator".


    Eric Yang [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, December 14, 2010 7:18 AM
  • Hi again Eric,

    Nope, still can not create the hook even run as admin.  I did find a way around this though, the original reason for using sendkeys was that unless you moved the cursor after the last entry in a datagrid the value would be ignored at automatic update upon closing the form, thus the sendkeys to another cell.  So now I use NavigateTo, which does the same thing.  But this still doesn't rectify my (admin) control over the security on my own machine.  I have a sneaking suspition that it has more to do with Win7 64 bit than it does with VB.net.  Let me know if you come up with any new wrinkles.

    Thank you,


    Nitromuse
    Wednesday, December 15, 2010 9:29 PM