{"id":184,"date":"2007-05-12T16:45:46","date_gmt":"2007-05-12T14:45:46","guid":{"rendered":" http:\/\/www.nsonic.de\/blog\/2007\/05\/keyb_event-simulating-keypress-part-2\/"},"modified":"2007-05-12T16:45:48","modified_gmt":"2007-05-12T14:45:48","slug":"keyb_event-simulating-keypress-part-2","status":"publish","type":"post","link":"https:\/\/www.nsonic.de\/blog\/2007\/05\/keyb_event-simulating-keypress-part-2\/","title":{"rendered":"Keyb_event (simulating Keypress part 2)"},"content":{"rendered":"<p><em>> I&#8217;ve already got a handle of another application&#8217;s window. Now, how can I<br \/>\n> simulate a keyboard input of &#8216;ALT-R&#8217; to it?<br \/>\n> Thank you.<br \/>\n<\/em><br \/>\nUse the keyb_event function:<\/p>\n<p>[code lang=&#8221;delphi&#8221;]\/\/ press:<br \/>\nkeyb_event(VK_MENU,0,0,0);<br \/>\nkeyb_event(Ord(&#8216;R&#8217;),0,0,0);<br \/>\n\/\/ release:<br \/>\nkeyb_event(Ord(&#8216;R&#8217;),0,KEYEVENTF_KEYUP,0);<br \/>\nkeyb_event(VK_MENU,0,KEYEVENTF_KEYUP,0);<br \/>\n[\/code]<\/p>\n<p>&#8212;&#8211;8<-------snip-------8<----------snap----------\n\n> I know this a dumb question but how do I make the system think the user<br \/>\n> pressed Enter from somewhere other than the onKeypress or OnKeyDown events?<\/p>\n<p>[code lang=&#8221;delphi&#8221;]  {Key Down}<br \/>\n  keybd_Event(VK_RETURN, 0, 0, 0) ;<br \/>\n  Sleep(100);<br \/>\n  {Key Up}<br \/>\n  keybd_Event(VK_RETURN, 0, KEYEVENTF_KEYUP, 0);<br \/>\n[\/code]<\/p>\n<p>[tags]Delphi, Misc[\/tags]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>> I&#8217;ve already got a handle of another application&#8217;s window. Now, how can I > simulate a keyboard input of &#8216;ALT-R&#8217; to it?&hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":""},"categories":[11],"tags":[75,107],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p71Tml-2Y","_links":{"self":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/posts\/184"}],"collection":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/comments?post=184"}],"version-history":[{"count":0,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/posts\/184\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/media?parent=184"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/categories?post=184"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/tags?post=184"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}