Solved

Shell Question VB.Net

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

910 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

24 Experts available now in Live!

Get 1:1 Help Now