?
Solved

Shell Question VB.Net

Posted on 2006-06-22
3
Medium Priority
?
250 Views
Last Modified: 2010-04-23
I need to run an application by stating its associated file....

emulating when you click on a known file type in a drive window and having windows start the editor for that file type and loading the file to edit that I clicked on....

Can you tell me how you do that???

0
Comment
Question by:ExtremeFitness
  • 2
3 Comments
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 2000 total points
ID: 16960396
Simply...

    Process.Start("c:\someFile.ext")
0
 
LVL 2

Author Comment

by:ExtremeFitness
ID: 16960549
Do you know how I have the calling program wait until the called program exits?
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 16960602
The simplest method would be:

        Dim p As Process = Process.Start("c:\someFile.ext")
        p.WaitForExit()

*** BUT *** this locks up the calling process until the spawned process exits.

You can use a Polling loop like this though:

        Dim p As Process = Process.Start("c:\someFile.ext")
        While Not p.HasExited
            System.Threading.Thread.Sleep(100)
            Application.DoEvents()
        End While

If a polling loop is unacceptable then encapsulate the Process() in a Class and place it on a different thread.  Then you use WaitForExit() without locking up your GUI.  Make the Class raise a custom event when the Process is complete.  Since you are using Threads, you would need to Marshal the event back onto the main UI using a Delegate and Invoke().  Let me know if you want to see an example of this...
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Screencast - Getting to Know the Pipeline
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question