Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Visual Basic AppActivate  + ProcessID of Internet Explorer Object

Posted on 2003-11-16
16
Medium Priority
?
2,307 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
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 200 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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.
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 lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

927 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