Close an Explorer Window in VB .NET

I am running Winzip to extract some files into a folder. When this has completed the parent folder of these files is opened as an explorer window. How can I close this window programatically in VB .NET using the title of the Window?
Blowfelt82Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Blowfelt82Connect With a Mentor Author Commented:
I have found the solution to this... By using the following code...

objProcess.MainWindowHandle = IntPtr.Zero

You can determine whether a Window is visible to the user, rather than a process running in the background.
0
 
Blowfelt82Author Commented:
Its the right idea but I am using Windows Explorer not Internet Explorer, so I dont think that each folder window that is open is handled as a seperate process but instead is all handled by the explorer.exe process. In task manager within the Applications tab there is an entry for each of the folders, but in the processes tab only explorer.exe is displayed.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
halfbloodprinceCommented:
Try calling this subroutine:
Private Sub KillProcess()
For Each clsProcess As Process In Process.GetProcesses
If clsProcess.ProcessName.ToLower.StartsWith("explorer") Then
clsProcess.Kill()
Next
End Sub
0
 
Blowfelt82Author Commented:
That will just shut down explorer which is not what I want to do... I want to shutdown a specific explorer window. For example if I press {Windows} + E, how could I then use VB .NET code to shut this down?
0
 
gamarrojgqCommented:
Hi,

If you are using Shell to call Winzip you can try SendKeys like this:

SendKeys.Send("%{F4}")

this emulates Alt+F4
0
All Courses

From novice to tech pro — start learning today.