Task Scheduler changes 'focus' of my C# application RRS feed

  • Question

  • I have an application that: a). creates a Form, b). adds some controls (TextBoxes and Buttons), c). manipulates the controls using SendKeys and Click events.  I traverse the controls by sending string input and the {Tab} charater to the TextBoxes in order to update the Text field and move on.  If I run the executable (*.exe) everthing is fine.  However if I call the executable from the Task Scheduler I cannot seem to control the focus on the controls.  So when I do a 'SendKeys' and 'Tab' to the next control, it starts tabbing through the icons on the Taskbar.

    Any suggestions on how to maintain/force focus on my Form when called using the Task Scheduler?  I have tried all sorts of combinations of Activate and Focus on the Form and the TextBoxes.  Are there some underlying Thread issues when using the Task Scheduler that I'm not aware of?


    Thanks for any suggestions.

    Tuesday, July 3, 2012 1:23 PM


  • I think similar question is been asked here. Please check the thread which is marked as answer.

    If this post answers your question, please click Mark As Answer. If this post is helpful please click Mark as Helpful.


    • Marked as answer by Lisa Zhu Thursday, August 9, 2012 9:57 AM
    Tuesday, July 3, 2012 1:36 PM