Solved

Shell Question VB.Net

Posted on 2006-06-22
3
197 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 85

Accepted Solution

by:
Mike Tomlinson earned 500 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 85

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now