Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sending keystrokes to window
Message
From
11/05/2006 09:08:35
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Title:
Sending keystrokes to window
Miscellaneous
Thread ID:
01120957
Message ID:
01120957
Views:
55
The code below successfully finds the window I want it to and sets focus to it but the keyboard command does not work. The same code worked with an open Notepad instance though. I was able to sent '{CTRL-O}' to notepad which brought up the open dialog box. any ideas?
DECLARE INTEGER FindWindow IN user32;
        STRING lpClassName, STRING lpWindowName  
   
  hwnd = FindWindow(.NULL.,[Program Error])
  
  
  DECLARE INTEGER SendMessage IN user32;
    INTEGER hWnd,;
    INTEGER Msg,;
    INTEGER wParam,;
    INTEGER lParam 
    
 DECLARE INTEGER SetForegroundWindow IN user32 INTEGER hwnd
    
    
 if hwnd > 0
	SetForegroundWindow(hwnd)
	keyboard '{ALT-C}'	
 endif    
Next
Reply
Map
View

Click here to load this message in the networking platform