Open then Close Explorer directory using Process.Start

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.
 
M

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()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top