activate window

Shiming Dong dong_sm at
Thu Jan 15 13:47:50 CST 2004

Hi there:
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:
int main( )
  HWND hwnd = FindWindow(NULL, "Untitled - Notepad");
  short f3_key = VK_F3;
  UINT scancode = MapVirtualKey(f3_key, 0);
  if (hwnd!=NULL){
       printf("Notepad is running!\n");
  PostMessage(hwnd, WM_SYSKEYDOWN, f3_key, scancode);
  PostMessage(hwnd, WM_SYSCHAR, f3_key, scancode);
  PostMessage(hwnd, WM_SYSKEYUP, f3_key, scancode);
return 0;

Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the wine-devel mailing list