Skip to Content
author's profile photo Former Member
Former Member

vb.net : SendKeys.Send don't work , SendKeys.SendWait -->deadlock

hi,

i active the printer dialog by menu 520 and want to send some keys.

moSBOApplication.ActivateMenuItem("520") 
...
i fetch the printer dialogue by the MENU-EVENT
Select Case pVal.MenuUID
            Case "520":
                        SendKeys.SendWait("E")
                        SendKeys.SendWait("{TAB}")
                        SendKeys.SendWait("{ENTER}")

My code worked well in vb6, but now i need the same behaviour in vb.net, but it don't seem to work.

In vb6 i used sendkeys.send("E")

when i use this in vb.net there is the following error:

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.

But when i use sendkeys.sendwait("E") the systems will stay in deadlock and i get no controll anymore.

Does anybody knows how to solve this?

thanks

Markus

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 20, 2007 at 03:24 PM

    nobody an idea?

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Ad Kerremans

      Hi together,

      I had the same problem. But I solved it by using a new thread.

      1st) The major problem is, that the printer dialog is modal to SBO and you are not able to send commands like sendkeys. One possibility is to fill the keyboard buffer with hundred of TAB and ENTER Keys but that's not very nice.

      2nd) In my first try I started a new thread before activating the SBO Menu Item. The Thread looked by using WinAPI for the printer window (you should look for the child windows of your SBO application, to verify that your get the right window) and then send TAB and ENTER. It works fine.

      3rd) In my last try and this is the way I am doing print jobs now, is to post a new click message into the windows message queue. So my program simulates a mouseclick to the Print button.

      If you want to get some code... feel free to ask!

      Regard,

      Sebastian

  • author's profile photo Former Member
    Former Member
    Posted on Dec 03, 2007 at 03:19 PM

    I posted a new message for you...

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.