Share via


How do I change the application to handle windows messages?

Question

Tuesday, August 3, 2010 9:47 AM

I tried using SendKeys.Send("{TAB}");

to tab to the next control on my form.

I get error message,

"SendKeys cannot run inside this application because the application is not handling Windows messages.  Either change the application to handle messages, or use the SendKeys.SendWait method."

How do I change the application to handle windows messages?

Regards Tony

All replies (3)

Tuesday, August 3, 2010 11:31 AM âś…Answered

Thanks Eyal,

This link will take others to the thread with your solution.

http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/275b1275-bbe2-4780-b5eb-dbbcc3d27f5d

Thanks again.


Tuesday, August 3, 2010 9:53 AM

Hi,

Thanks for your post.

Use Form.ShowDialog method instead of Form.Show method. This may solve it.

Sincerely,

Yasser

LEARN HOW WPF IS FLEXIBLE IN PRESENTATION DURING A QUICK SIMPLE WALKTHROUGH:
Walkthrough: Displaying multi column ComboBox by using Windows Presentation Foundation (WPF) data templating


Tuesday, August 3, 2010 10:59 AM | 1 vote

Hello,

I know it's related to your first thread 'focus on a textbox' you may want to try my solution.

p.s. SendKeys is not reliable, it seems like a hack and I'd avoid it if possible.

Eyal, Regards.

blog.eyalsh.net