Robert Homes
Member
- Joined
- Nov 16, 2023
- Messages
- 11
- Programming Experience
- 5-10
I want to be able to issue a command in VB to open a folder in Windows Explorer and position the folder where I want it on the screen.
Sub MoveAllExplorerWindows()
Dim ExplorerFileName As String
For Each ExplorerWindow As SHDocVw.InternetExplorer In New SHDocVw.ShellWindows()
ExplorerFileName = Path.GetFileNameWithoutExtension(ExplorerWindow.FullName).ToLower()
If ExplorerFileName.ToLowerInvariant() = "explorer" Then
ExplorerWindow.Left = 100
ExplorerWindow.Top = 50
ExplorerWindow.Width = 400
ExplorerWindow.Height = 400
End If
Next ExplorerWindow
End Sub
Process.Start("c:\windows\explorer.exe")
' wait a few seconds for it to load
Dim starttime As Date = Now
Label1.Text = "waiting 3 seconds for it to open"
Do Until Now > DateAdd("s", 3, starttime)
Application.DoEvents()
Loop
Label1.Text = "done waiting"
Application.DoEvents()
MoveAllExplorerWindows()
Imports System.Diagnostics