Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Send a keystroke to a hwnd window
Message
From
25/03/2004 14:29:11
 
 
To
25/03/2004 14:13:22
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00889676
Message ID:
00889737
Views:
24
hello Tracy,

maybe i am way off here but there are two things i am thinking of right now:

1. i you send keystrokes, make sure there is an object on the 'password' window that knows what to do with it. if u whant to fill a text box, make sure the textbox has the focus when the window receives the message. if u need to send some data to some of your code in the window, you need to register a new message with windows, and then catch it manually.

2. if you have a textbox (not an editbox), i don't think you should send a chr(13) after the string, because then you're sending a two-liner, and the text box will show you the 2nd line (which is empty).

hope i am not too far off :-)



>Well the below should work, but nothing gets put in the password window.
>
>
>DO WHILE CheckWin('Password')
>   *--This will display until I close the password window as it should
>   WAIT WINDOW "Found the password window" NOWAIT
>ENDDO
>RETURN
>
>FUNCTION CheckWin
>PARAMETER tcTitle
>
>lnwindow = FindWindow(0,tcTitle)
>IF lnwindow > 0
>   #DEFINE WM_KEYDOWN  0x0100
>   DECLARE SHORT SendMessage IN user32;
>       INTEGER   hWnd,;
>       INTEGER   Msg,;
>       STRING  @ wParam,;
>       INTEGER   lParam
>
>    hwnd = lnwindow
>    cmessage = 'password'+CHR(13)
>    ReturnValue = SendMessage(hwnd, WM_KEYDOWN, @cmessage, 0)
>    RETURN .T.
>ELSE
>    RETURN .F.
>ENDIF
>
>
>Yet if I run that loop the wait window displays nonstop (as it should) until I close the password window. Once I do that, it exits the loop because lnwindow returns false. So everything is working EXCEPT sending the keystrokes to taht password window... Sheesh, you'd think it was Friday! :o()
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform