Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / June 2007

Tip: Looking for answers? Try searching our database.

Remember App. chosen in 'Open With...' dialog

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jeroen - 29 Jun 2007 11:49 GMT
The group and search engines revealed many hints on how to use the
'Open With...' dialog, for example at:

http://www.codeproject.com/csharp/openwith.asp

Now in addition to a solution as presented in the tutorial above, I
would like to remember the application that was chosen, so that I
don't have to ask the user next time.

The situation I'm trying to tackle is as follows. Our application
generates an html. I would like to offer them the 'Open With...'
dialog (they're familiar with) to let them choose the program they
want to use from then on to open html files generated in our
application.

Most commonly, we will have users that want to open html files
generated in _our_ application in MS Excel instead of their browser,
without changing the system wide setting for html files.

Any tips would be appreciated.
Peter Ritchie [C# MVP] - 29 Jun 2007 15:40 GMT
If I understand you correctly: you want to have files with a given extension
open in different applications when they're clicked in Windows Explorer?

The only way to do that is to write an application that is associated with
an extension and open another application based on some non-extension
criteria.

That's what Visual Studio does with *.*proj files.  A third application you
don't ever see checks the contents of the file then runs either Visual Studio
2003 or Visual Studio 2005...

Signature

Browse http://connect.microsoft.com/VisualStudio/feedback/ and vote.
http://www.peterRitchie.com/blog/
Microsoft MVP, Visual Developer - Visual C#

> The group and search engines revealed many hints on how to use the
> 'Open With...' dialog, for example at:
[quoted text clipped - 16 lines]
>
> Any tips would be appreciated.
Jeroen - 29 Jun 2007 16:16 GMT
On 29 jun, 16:40, Peter Ritchie [C# MVP] <PRS...@newsgroups.nospam>
wrote:
> If I understand you correctly: you want to have files with a given extension
> open in different applications when they're clicked in Windows Explorer?

Sorry, I probably explained the problem inadequately. In pseudocode,
the following is what I'm looking for:

/******************************/
class Example
{
    private static object SomeApplication = null;
    private static string FilePath = "C:\SomeJustCreatedFile.html";

    private void OpenMyFile ()
    {
        if (SomeApplication == null)
            SomeApplication = this.SelectAnApplicationThroughOPENWITH ();

        System.Diagnostics.Process process = new
System.Diagnostics.Process();
        process.Application = SomeApplication;
        process.File = FilePath;
        process.Start();
    }

    private object this.SelectAnApplicationThroughOPENWITH()
    {
        // Do something
    }
}
/*****************************************************/

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.