foregot something
you know (in VS 6 at least) you can use the spy program, set it up for your password window, and then you can see which messages were received.
>hmm, should be working. try sending 1 character at the time. you know the the difference between post- and send massage is that sendmessage will wait untill the receiving window has proccessed the message.
>
>
>>What is funny is that I can see the focus on the textbox in the password window (the cursor flashes hundreds of times in it so the setfocus is at least working) by testing the below:
>>
>>DO WHILE Checkwin('Password')
>> WAIT WINDOW "Cursor is flashing in textbox of password window" NOWAIT
>>ENDDO
>>RETURN
>>
>>FUNCTION CheckWin
>>PARAMETER tcTitle
>>
>>* Routine which sees if an application is active by looking for its
>>* Window title
>>* expC1 Window title
>>
>>DECLARE INTEGER FindWindow IN Win32API AS FindWindow STRING, STRING
>>
>>lnwindow = FindWindow(0,tcTitle)
>>IF lnwindow > 0
>> #DEFINE WM_KEYDOWN 0x0100
>> #DEFINE WM_SYSCOMMAND 0x0112
>> #DEFINE WM_COMMAND 0x00110818
>> #DEFINE WM_KEYUP 0x0101
>> #DEFINE WM_SETFOCUS 0x0007
>>
>> DECLARE SHORT PostMessage IN user32;
>> INTEGER hWnd,;
>> INTEGER Msg,;
>> STRING @wParam,;
>> INTEGER lParam
>>
>> hwnd = lnwindow
>> cmessage = 'password'+CHR(13)+CHR(0)
>> ReturnValue = PostMessage(hwnd,WM_SETFOCUS,0,0)
>> ReturnValue = PostMessage(hwnd,WM_KEYDOWN, @cmessage,0)
>> ReturnValue = PostMessage(hwnd,WM_KEYUP, @cmessage,0)
>> RETURN .T.
>>ELSE
>> RETURN .F.
>>ENDIF
>>
>>
>>
>>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()