AppActivate doesn't seem to work with SendKeys 
Author Message
 AppActivate doesn't seem to work with SendKeys

I have a VB.NET application which has a button click event both bring up and
take down an IE window. The code is as follows:

    'ProcessId is a Public integer variable
    If ProcessId = 0 then
        ProcessId = Shell("""C:\Program Files\Internet
Explorer\IEXPLORE.EXE"" ""filename""", AppWinStyle.NormalFocus)
        SendKeys.Send("%(FC)") 'Send the window an Alt-F, Alt C to close it

A click of the application's button brings up IE as expected, but then while
a later click of this button executes the "Else" code properly, it doesn't
close the IE window. The calling program loses focus, but the IE window
doesn't seem to gain the focus in order for the SendKeys command to close
it. Its like the AppActivate command is only doing half the job.

What am I missing here?

Don Peters

Sun, 27 Nov 2005 06:01:45 GMT  
 AppActivate doesn't seem to work with SendKeys

The issue is probably a timing issue:  appactive is called correctly, but
it takes a while for the process to get focus.  Sendkeys is probably
sending the keys too early.  Try putting in a "sleep" command like this

Also, if yoy may want to check the source code:  in the sample you're not
resetting the ProcessID to zero in the Else.

Tue, 29 Nov 2005 04:11:00 GMT  
 [ 2 post ] 

 Relevant Pages 

1. AppActivate doesn't work with Win 98 SE

2. AppActivate doesn't work on hidden dial up networking

3. HitTest doesn't seem to work as expected

4. FormField.EntryMacro doesn't seem to work

5. AddHandler doesn't seem to work

6. AddHandler doesn't seem to work

7. Adding CookieCollection to WebRequest doesn't seem to work

8. close method on RegistryKey.OpenRemoteBaseKey doesn't seem to work

9. End of File doesn't seem to work

10. MSFlexGrid Refresh doesn't seem to work

11. Dblist doesn't seem to work correct

12. Recordset.Update doesn't seem to work


Powered by phpBB® Forum Software