Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


kill a specific process (IE page) VB.NET 2003

Posted on 2011-02-21
Medium Priority
Last Modified: 2012-05-11
Hi Experts,

My app will open apps 'Outlook', 'Notepad', etc... from WINFORM button.

But I want to open IE page with specific URL, but I also want to kill that specific web-page.

System.Diagnostics.Process.Start("IExplore.exe", "http://sample.com/")

'iexplore' is the process, but, if I have more than one IE page open, I don't want to close others.

Question by:RobertoFreemano
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

Expert Comment

ID: 34946218
Keep track of the Process IDs (PIDs) so you can shut down the right IE process.
LVL 16

Expert Comment

by:Kalpesh Chhatrala
ID: 34948561
Sample Code

1. Start notepad

2. Start winword

3. Start excel

4. Start ie and parameter
System.Diagnostics.Process.Start("IExplore.exe", "http://vbnetsample.blogspot.com/")

5. Kill It!!
' Kill all notepad process
Dim pProcess() As Process = System.Diagnostics.Process.GetProcessesByName("notepad")

For Each p As Process In pProcess
LVL 12

Accepted Solution

Hairbrush earned 400 total points
ID: 34950697
Hi, I think the problem with the code sample given by kalpesh is that it will kill the whole of IE?

I have tried the following code sample, and it works.  You will need to add a reference to the COM object c:\windows\system32\shdocvw.dll for this code to work.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        ' Get all opened IE instances
        Dim shellWindows As SHDocVw.ShellWindows = New SHDocVw.ShellWindowsClass()
        Dim ie As SHDocVw.InternetExplorer
        For Each ie In shellWindows
            ' Get URL of IE instance

            ' Close specific IE tab / instance
            If ie.LocationURL = "http://sample.com/" Then
            End If

        Next ie

    End Sub

Open in new window


Author Closing Comment

ID: 34953038
Magic ;)

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

604 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