>Hi All,
>
>I'm trying to use the sendkeys api to emulate user keystrokes to a specific window.
>
>But for some reason, the code isn't working. Can anyone see why this code isn't working?
>
>Thanks
>
>Mace
>The Code....
>
>LOCAL lcWindow
>
>lcWindow = "Save As"
>
>=RestoreWindow( lcWindow)
>=SendKey( "M", lcWindow)
>
>
>*****************************************************************
>FUNCTION SendKey
>LPARAMETERS tcKeyStroke, tcWindowTitle
>
>DECLARE INTEGER SendMessage IN WIN32API INTEGER, INTEGER, INTEGER, INTEGER
>
>=SendMessage( GetWindowHandle( tcWindowTitle), 256, ASC( tcKeyStroke), 0)
>=SendMessage( GetWindowHandle( tcWindowTitle), 257, ASC( tcKeyStroke), 0)
>
>RETURN
>
>
>**************************************************************
>FUNCTION GetWindowHandle
>LPARAMETERS tcWindowTitle
>LOCAL lnReturn
>
>*-- Make this into a generic function later...
>DECLARE INTEGER FindWindow IN WIN32API INTEGER, STRING
>
>lnReturn = FindWindow( 0, tcWindowTitle)
>
>RETURN lnReturn
Are you getting back a valid window handle? BTW, FindWindow() takes two strings passed by reference. The first parameter is the window's class name. If it's a null pointer (0) all classes match. The second is the window's title bar text, if that's a null pointer all window text matches. In both cases, the values passed are case sensitive and must match exactly.
George
Ubi caritas et amor, deus ibi est