Open then Close Explorer directory using Process.Start

  • Thread starter Thread starter Cerebrus99
  • Start date Start date
C

Cerebrus99

Hi Mike,

Try myProcess.Kill(). Be cautioned, though, because this method is not
recommended in most cases, since it causes abnormal program termination.

Regards,

Cerebrus.
 
I'm having difficulty getting this to work. Any help would be appreciated.
What I'm trying to do is to open Explorer onto the Windows/fonts directory
and then close it. I've added a font programmatically to the directory and
found that the easiest way to refresh the folder is to just open windows
explorer. Without doing this, it isn't refreshed in the system. I had the
same problem in VB6 and VBA as with VB.net. Searching the newsgroups showed
me that this same issue exists, with no good solution from Microsoft.

If I can just get my popup window to close, I'm good to go.

Here's my code. It works to open the window, but just leaves it open. I've
tried the Waitforclose options and a variety of different things, but no
luck:


Dim newProcess As Process

newProcess = Process.Start("Explorer.exe ",
"C:\Windows\Fonts")newProcess.CloseMainWindow()
newProcess.Close()
 
Back
Top