473,795 Members | 3,041 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1891
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...@newsgro ups.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:\SomeJustCre atedFile.html";

private void OpenMyFile ()
{
if (SomeApplicatio n == null)
SomeApplication = this.SelectAnAp plicationThroug hOPENWITH ();

System.Diagnost ics.Process process = new
System.Diagnost ics.Process();
process.Applica tion = SomeApplication ;
process.File = FilePath;
process.Start() ;
}

private object this.SelectAnAp plicationThroug hOPENWITH()
{
// Do something
}
}
/*************** *************** *************** ********/

Jun 29 '07 #3

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

Similar topics

1
2581
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 help me? Thanks. bestRegards from
5
3873
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 modal to my main window- even though I don't see how it could even be getting a reference to my main window. What I need is to open a new window but still have my main window available for interaction- the way it opens now it forces focus on this...
0
2979
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 entered. When this button is pressed and extract is prduced and IE's standard Open/Save dialog should popup so they can navigate to the directory to save the extract in, or if they want, they can choose to open and view the extract without saving it. ...
14
3775
by: Simon Abolnar | last post by:
I would like to know how to open child form from dialog form. Thanks for help! Simon
2
6157
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 loading images into the picturebox. If you double click the file you want to open in the open file dialog, it somehow interperets one of the clicks as a mouseup on the picturebox and fires the mouseup event for the picturebox. How can I get...
5
5407
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 my colleagues that this is not "standard" but find it hard to believe. Opening a file in MS word for example, the dialog has
6
1970
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 dialog box is disabled and i would like to have it where there is just one taskbar button for the application and be able to move the open dialog box outside the main window, im using visual studio 2005 in c++ and im doing a windows 32 application not...
7
4020
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(); Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);
5
6210
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 found this solution: http://www.codeproject.com/KB/shell/openwith.aspx but it's not good for me since it will execute the process directly.
1
10164
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10001
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9042
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7540
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6780
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5437
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3727
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.