SendKeys.Send only runs first time

  • Thread starter Thread starter alfred.sehmueller
  • Start date Start date
A

alfred.sehmueller

Hello,

i built a small system-tray application that listens to a hotkey builds
a string and inserts the string to the active application using
SendKeys.Send()

The Problem is - this works only once. The hotkey is still o.k. (i also
copy the string to the clipboard, here I always get the correct string
that contains a timestamp) but sendkeys sends strange characters the
second time:

{}[}}[²
or
{}[}}[}

Depending on the active application sometimes the second time no string
at all is sent.

Can you please help me with this?

Thanks Alfred
 
I havent used sendkey for years, and i have always had problems, if you want
to put some text in somewhere you may be able to use the clipboard and send
the Windows Message the triggers a Paste.

Steve


Hello,

i built a small system-tray application that listens to a hotkey builds
a string and inserts the string to the active application using
SendKeys.Send()

The Problem is - this works only once. The hotkey is still o.k. (i also
copy the string to the clipboard, here I always get the correct string
that contains a timestamp) but sendkeys sends strange characters the
second time:

{}[}}[²
or
{}[}}[}

Depending on the active application sometimes the second time no string
at all is sent.

Can you please help me with this?

Thanks Alfred
 
Try using SendWait() instead of Send() in order to make sure the first group
of keys was processed by the receiver before sending another group.

Brendan
 
Thanks for your answer,

the problem is, the users don't wan't to loose there current clipboard.
That's why I thought about sendkeys

Bye Alfred
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top