<DIV>Hi there:</DIV>
<DIV>&nbsp;</DIV>
<DIV>I met with one problem. I try to send a simulated keystroke to another application (such as Notepad)&nbsp;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>&nbsp;</DIV>
<DIV>int main( )<BR>{<BR>&nbsp; HWND hwnd = FindWindow(NULL, "Untitled - Notepad");<BR>&nbsp; short f3_key = VK_F3;<BR>&nbsp; UINT scancode = MapVirtualKey(f3_key, 0);</DIV>
<DIV>&nbsp; </DIV>
<DIV>&nbsp; if (hwnd!=NULL){<BR>&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; printf("Notepad is running!\n");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SetActiveWindow(hwnd);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SetFocus(hwnd);<BR>&nbsp; }</DIV>
<DIV>&nbsp; PostMessage(hwnd, WM_SYSKEYDOWN, f3_key, scancode);<BR>&nbsp; PostMessage(hwnd, WM_SYSCHAR, f3_key, scancode);<BR>&nbsp; PostMessage(hwnd, WM_SYSKEYUP, f3_key, scancode);</DIV>
<DIV>&nbsp;&nbsp;</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>