<DIV>Hi there:</DIV>
<DIV> </DIV>
<DIV>I met with one problem. I try to send a simulated keystroke to another application (such as Notepad) to invoke one of its functions, but when I minimize the window of "Notepad", the message cannot be received even I used the SetFocus() and SetActiveWindow() function. When it is maximized, it works. Anyone can help? Here are my codes:</DIV>
<DIV> </DIV>
<DIV>int main( )<BR>{<BR> HWND hwnd = FindWindow(NULL, "Untitled - Notepad");<BR> short f3_key = VK_F3;<BR> UINT scancode = MapVirtualKey(f3_key, 0);</DIV>
<DIV> </DIV>
<DIV> if (hwnd!=NULL){<BR> printf("Notepad is running!\n");<BR> SetActiveWindow(hwnd);<BR> SetFocus(hwnd);<BR> }</DIV>
<DIV> PostMessage(hwnd, WM_SYSKEYDOWN, f3_key, scancode);<BR> PostMessage(hwnd, WM_SYSCHAR, f3_key, scancode);<BR> PostMessage(hwnd, WM_SYSKEYUP, f3_key, scancode);</DIV>
<DIV> </DIV>
<DIV>return 0;<BR>}</DIV><p><hr SIZE=1>
Do you Yahoo!?<br>
Yahoo! Hotjobs: <a href="http://pa.yahoo.com/*http://us.rd.yahoo.com/hotjobs/mail_footer_email/evt=21482/*http://hotjobs.sweepstakes.yahoo.com/signingbonus">Enter the "Signing Bonus" Sweepstakes</a>