I found the original MSDN article suggesting your method. http://social.msdn.microsoft.com/Forums/en/visualfoxprogeneral/thread/f46be74c-c3b9-4c71-b1b5-d648626ca744
I copied the codes from that MSDN. First time I hit the button, the keybd_event() worked. Then on the next button push to activate keybd_event() again, no response. Then I pushed the button again, it worked. And the things repeated. Anyway, I still prefer not to use SetForegroundWindow() before sending a keyboard. That's why I wanna use SendMessage() which accepts a hWnd. On Wed, Mar 7, 2012 at 10:27 PM, Christof Wollenhaupt <[email protected]> wrote: > That might be easier using the keybd_event function ( > http://msdn.microsoft.com/en-us/library/windows/desktop/ms646304(v=vs.85).aspx -- .~. Might, Courage, Vision. SINCERITY! / v \ 64-bit Ubuntu 9.10 (Linux kernel 2.6.39.3) /( _ )\ http://sites.google.com/site/changmw ^ ^ May the Force and farces be with you! _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/CAGv=MJAF_eZiRZ49T5-1Z6Ny_=4oyabootjdsjjuh1sg9vo...@mail.gmail.com ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

