Solved

Shell Question VB.Net

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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

770 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