Home All Groups Group Topic Archive Search About

Open then Close Explorer directory using Process.Start

Author
16 Feb 2006 7:21 PM
Mike Kober
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()

Author
15 Feb 2006 8:25 PM
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.


Show quoteHide quote
"Mike Kober" <mko***@wi.rr.com> wrote in message
news:u#w2y4yMGHA.1312@TK2MSFTNGP09.phx.gbl...
> 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()
>
>
>
>