473,396 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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

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.

Jun 29 '07 #1
2 1877
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...

--
Browse http://connect.microsoft.com/VisualStudio/feedback/ and vote.
http://www.peterRitchie.com/blog/
Microsoft MVP, Visual Developer - Visual C#
"Jeroen" wrote:
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.

Jun 29 '07 #2
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
}
}
/************************************************** ***/

Jun 29 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Steven | last post by:
Hello, I have a problem in using TreeView. I want to remember the path I have accessed. When I open the dialog of this TreeView next time , it could be opened automatically. Does anyone can...
5
by: MrNobody | last post by:
I am using the no-arg ShowDialog() method hoping that the window would not be modal to any other window like the other ShowDialog(IWin32Window) method does, but when this opens it somehow becomes...
0
by: Dune | last post by:
Hi there, I have an aspx page that allows users to enter several parameters using drop downs and text boxes. The users then press a button that produces an extract based on the parameters they...
14
by: Simon Abolnar | last post by:
I would like to know how to open child form from dialog form. Thanks for help! Simon
2
by: Mattbooty | last post by:
Hello, Not sure if anyone else has seen this bug, but I have a form where the entire form is covered with a picturebox. The picturebox has a mouseup event. I also have an open file dialog for...
5
by: charles | last post by:
I have a question about the file Open dialog box. I would like to be able to make the dialog box bigger by selecting the bottom right-hand corner and dragging/expanding the box. I am told by...
6
by: joder2006 | last post by:
i'm writing a program that uses an open dialog box, i would like to create an open dialog box that behaves like ones in other programs such as word, that has it where the window behind the open...
7
by: Peter | last post by:
ASP.NET 2.0 I am trying to open a Word document and Excel document from a dialog web page, what's the best way to do that? I have tried the following: Response.Clear();...
5
by: Stefano Tonello | last post by:
Hi all, I need to call windows' "open with" dialog from my C# windows form application. After the user selects application, control must return to me (I have to launch directly the process). I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.