Visual Basic AppActivate + ProcessID of Internet Explorer Object

I need to locate an Internet Explorer using AppActivate and then click press Enter. If there are more than 1 Internet Explorers opened, how can I open locate the Internet Explorer ? How can i get the process ID of an Internet Explorer Object ?

 I can just find these references , can anyone tell me more on the solution?

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbenlr98/html/vastmappactivatex.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vbCode/html/vbtskCodeStartingApplicationSendingItKeystrokesVisualBasic.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vafctShell.asp
mikekwokAsked:
Who is Participating?
 
NBrownohCommented:
in that code where it says "ieframe" thats the class pointer to find, not the window title.  If you dont want to hard code the title in to find the exact IE window then there really isnt a way unless you want to enumerate all the windows and search for the one that has a matching title, which will be slower.
0
 
NBrownohCommented:
there might be an easier way, what exactly are you trying to do, just view a web site?  there is a control included with VB that allows you to do that, the other way is by using API and youll need to raise the points on that one.
0
 
mikekwokAuthor Commented:
I need to press enter when an internet explorer open an dialog. therefore i use appactative + want to get the processid of the internet explorer object . do u know how to do so ?
i want to get the processid of internet explorer object in visual basic.
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
NBrownohCommented:
yeah i can do that, but i need to know which internet explorer thingy you want to be sending keystrokes too?
0
 
mikekwokAuthor Commented:
yes , just send keystroke.

0
 
NBrownohCommented:
yeah, but if there are multiple IE windows open which one will you want, does it have a special caption, or does it not matter, you just want any IE window?
0
 
NBrownohCommented:
also, where do you want to send the keystroke Enter to?  the address bar?
0
 
mikekwokAuthor Commented:
Internet Explorer will popup a secure dialog and i have to press enter.
i just want to know how can i get the process id of the internet explorer according to the URL so that i can use appactative to get focus to that internet explorer  and then click enter( send Enter keystroke)
0
 
NBrownohCommented:
ok, give me the url to the website your going to that popsup the secure dialog so i can code this for you :)
0
 
mikekwokAuthor Commented:
it is secure page and need login and password.
 i just want to know how can i get the process id of the ineternet explorer .
0
 
NBrownohCommented:
in a form put this:

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
Dim ieframe As Long
Private Sub Form_Load()
    Dim ieframe As Long, ProcID As Long
    ieframe = FindWindow("ieframe", vbNullString)
    GetWindowThreadProcessId ieframe, ProcID
    'ProcID is now the process ID of an IE window
    'whether or not this is the right IE window?
End Sub
0
 
mikekwokAuthor Commented:
I know the URL of the internet explorer. I want to get the process id of that internet explorer.
I don't want to input the title in the findwindow in order to find the process id of the internet explorer , do u know how? Thanks.
0
 
mikekwokAuthor Commented:
Public Sub click_Security_dialog(Language As String)
    On Error GoTo ErrorHandler
    If Language = "e" Then
        AppActivate "Security Information"
    ElseIf Language = "tc" Then
        AppActivate "安全性資訊"
    End If
    Dim clskey As New clsKeyboard
    Call clskey.PressKeyVK(keyReturn)
    Exit Sub
ErrorHandler:
Wait 1
Resume
End Sub

This code is for pressing dialog when internet explorer open. But it doesn't work when i try to open more than 1 internet explorer using visual basic and in these internet explorers pop up dialogs.

would some body tell me how to solve my problem ?  my program open 2 browsers and 2 pop up dialog and i need to press enter on that. it sometimes work but it sometimes doesn't work using the code above.
0
 
DanRollinsCommented:
Moderator, my recommended disposition is:

    Accept NBrownoh's comment(s) as an answer.

Dan Rollins -- EE database cleanup volunteer
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.