Solved

Visual Basic AppActivate  + ProcessID of Internet Explorer Object

Posted on 2003-11-16
16
2,177 Views
Last Modified: 2013-11-25
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
0
Comment
Question by:mikekwok
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 6
16 Comments
 
LVL 3

Expert Comment

by:NBrownoh
ID: 9761548
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
 

Author Comment

by:mikekwok
ID: 9761690
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
 
LVL 3

Expert Comment

by:NBrownoh
ID: 9761727
yeah i can do that, but i need to know which internet explorer thingy you want to be sending keystrokes too?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:mikekwok
ID: 9761734
yes , just send keystroke.

0
 
LVL 3

Expert Comment

by:NBrownoh
ID: 9761739
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
 
LVL 3

Expert Comment

by:NBrownoh
ID: 9761749
also, where do you want to send the keystroke Enter to?  the address bar?
0
 

Author Comment

by:mikekwok
ID: 9761778
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
 
LVL 3

Expert Comment

by:NBrownoh
ID: 9761785
ok, give me the url to the website your going to that popsup the secure dialog so i can code this for you :)
0
 

Author Comment

by:mikekwok
ID: 9761792
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
 
LVL 3

Expert Comment

by:NBrownoh
ID: 9761805
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
 

Author Comment

by:mikekwok
ID: 9761834
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
 
LVL 3

Accepted Solution

by:
NBrownoh earned 50 total points
ID: 9761849
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
 

Author Comment

by:mikekwok
ID: 9926502
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
 
LVL 49

Expert Comment

by:DanRollins
ID: 10548521
Moderator, my recommended disposition is:

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

Dan Rollins -- EE database cleanup volunteer
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Suggested Courses
Course of the Month8 days, 13 hours left to enroll

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question