.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

How can I get a list of applications registered for a certain file extension in a WPF application?

Posted By:      Posted Date: October 07, 2010    Points: 0   Category :WPF
I'm looking for a Win32 or Shell function that can be called from a WPF application to get a list of registered applications in Windows for a specific file extension. For instance if I would pass ".rtf" to the function it should return something like "Microsoft Office Word|C:\Program Files\Office\Winword.exe|Wordpad, C:\Program Files\Windows NT\Accessories\wordpad.exe". I need this to construct a 'Open with' context menu somewhat related to the file context menu in Windows Explorer. In Windows Forms I could get the the Windows Explorer context menu with IContextMenu, IShellFolder etc. But this approach requires a WndProc because the context menu data will be send with WM_ messages. But for WPF this is not an acceptable solution because there is no WndProc. I know that I can get that data from the registry HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.png\OpenWithList but I will not use it because in a future Windows release the registry structure may change and this would break my application. I also don't want to mess around in Windows internal data. And there is no list to get anyway. All I found in the registries .png\OpenWithList key was a DllHost.exe and mspaint.exe. But DllHost.exe is no application to open a .png file. And the mspaint.exe doesn't specify a path. The display names are also missing.

View Complete Post

More Related Resource Links

how to consume the dll file which is registered in GAC, into my asp.net web application



i have created a strong name key to my dll file...and then i have added it to GAC.

In general, to add a .dll file in the solution explorer, right click -> add reference...

How should I refer the dll file registered in  GAC



Application Architecture in Windows Forms 2.0-Single-MDI Applications

Consider an MDI application like Microsoft Excel; files opened from the file system (by double-clicking) are all opened as separate child windows within the parent Excel window.7 For the first instance of an MDI application to open a new child window to display the file that was passed to the second instance of the application, the second instance must be able to communicate with the initial instance.

New off line application working with sdf file. Need advice


Hey Folks

I am working on a project currently where I need to get data out of a 3rd party vendor's software that uses a .sdf file I looked this up and its a SQL CE file. I was hoping to just link to with with access but thats apparently not going to happen. I need to link to the database extract data from it to a csv file for later use. I also and most important I need to get the data from it and create a report that can be printed while on a customers site that my or may not have web access so I need for this program to be on and off line. I had my webapplication that I have been working on open and was able to bring up the sdf file under the server exploere however I can't seem to get anything out of it when I try to do grid views or detail views errors out.

Can I use one of Visual Studio projects to create this sort of applicaiton if so what would be the best approach. I would love to get an access odbc driver since office is allready installed on the employee's laptop's



Read Excel file from Web Application (C#)



I have a web app where user uploads a file.

File is saved in server locally and I want to read some data from it.

Currently my development  server has office 2003.

So do I need office 2007 in order to be able to  read an excel from office 2007 ?

What are other requirements  ?

I tried a test, using

Microsoft.Office.Interop.Excel.Application excelApp = new Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Interop.Excel.Workbook wrkBook; // = new Microsoft.Office.Interop.Excel.Workbook();

wrkBook = excelApp.Workbooks.Open(@"C:\www\excel_files\b.xls", ....);

But When trying to open the file I get the error:

Exception from HRESULT: 0x800A03EC

So I'm wondering what I'm missing.


An example of packaging web application containing database upgrade SQL file

A few months ago, we have a blog talking about extending the web publishing pipeline to package database project deployed SQL file.  In this blog, I'll show step by step example of packaging web application with SQL Server database upgrade SQL file using Visual Studio 2010.  This way, we can generate a web package with incremental SQL script to certain database version.  The scenario may help distributions of a web upgrade package which needs to be installed on many different locations, each with their own SQL server database.   1. Create a Web Application Project 2. Add a new "SQL Server 2008 Database Project" to the solution 3. Prepare a development database, such as my test1 database as the following: 4. Right click our...(read more)

what is .htc file and how do I add this file to my asp.net 2.0 web applications

what is .htc file and how do I add this file to my asp.net 2.0 web applications   give me idea or tell me how to do that\ thank you maxmax

List common file types in a .NET project.

List common file types in a .NET project.

how do I support a "list of approved applications" that can connect?

Suppose I have two instances of an API -- one for production and one for staging. Both use integrated security. Anybody (on the LAN) can write an application that connects to the staging API. However, I want to restrict the applications that connect to the production API (until they've been well tested, etc.). What is the right way to perform this restriction in WCF? I don't even know what unique terminology to use for a web search on this topic.

using application configuration file in AppData special folder

Hi! So I understand it is a best practice to save the application configuration files under the AppData folder, rather than in Program Files, since UAC will restrict write acces to the Program Files folder, which is fine. Now, saving the configuration file to another location is no problem, using the SaveAs method. However, when I load the application, I expect some settings to be read. From what I know, this is done either using direct calls to the ConfigurationManager class, either initializing a Configuration object. For the first case, a example is this: if (ConfigurationManager.AppSettings["Title"] != null) { this.Title = ConfigurationManager.AppSettings["Title"]; titleTextBox.Text = ConfigurationManager.AppSettings["Title"]; } For the second case, I would use it like this: Configuration config = ConfigurationManager.OpenExeConfiguration( ConfigurationUserLevel.None); string setting = config.AppSettings.Settings["Title"].Value.ToString(); So, if the application runs in the Program Files folder, an exception is thrown when I save the file. However, if I save the file using SaveAs and save it to AppData folder, obviously, when loading, the settings are not loaded from the AppData folder, but from the configuration file existing in the Program Files folder. One way to solve

Web Application list in Central Admin in 2007

Can somebody tell me where Central Admin pulls the data for: Central Administration > Application Management > Web Application List   Somehow, the name for one of my applications has changed, but the URL has remained the same.  The website content itself, the website in IIS, and the content database name all still appear to be intact and nothing has changed there.  Everything seems to be fine, I just happened to notice that the NAME of this one web application has changed and it's really bothering me that it could possibly be pointing to the wrong data.  HELP please!

Powershell script to copy a list attachment to a file

I have a script that builds a list of items.  I'd like to add the ability to download the list items' attachments to a local directory.  IS this possible?  There are lots of examples of how to add attachments but nothing that can download the attachments.  Any help would be appreciated.

Move custom list (with lookup fields) to another Web Application

Is it possible to move a custom list with lookup fields to other custom lists from one web application to another? Creating list templates does not work and breaks the relationship. Thanks.   Neil

What registry keys are responsible for file extension association?

I'm trying to associate file extension to start some type of files with my application. Which registry keys I have to modify to be sure, that when user double click at file it opens with my application. And how get delete/modify permisions to key "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\<extension>\UserChoice"? This key created after setting default program by "Open with" dialog. I've tried: string ext=".eee"; RegistryKey r = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts\\"+ext); RegistryPermission f = new RegistryPermission(RegistryPermissionAccess.Write, r.Name); f.Assert(); r.OpenSubKey("UserChoice", true); //at this step "Requested registry access is not allowed." exception occured

How to show link file extension (lnk) in Explorer

My folders normally shows the file name extension.  But I have a folder full of window links and DOS links. I'm sure that is not the correct termioligy but it is the best I can do. I think I'm talking about .lnk and maybe .pif files. Anyway, the extension do not show in the folder listings. Can I make them show?   Thanks  

customize list view table header css file

i need to make table header for my list to be red and on hover to get specific  image so all my site have the same appearence also i need this to reflect to the list view webpart thanks

Maintain users and groups list of Active Directory for an asp.net web application only

Hi, I have configured active directory in my server 2008. We have a web project using asp.net mvc named Audit planning and Execution Software(Apex2).What we want to do is to authenticate Active directory users for this project.I can get all active directory users, groups, users of a group etc.I want to add users in active directory for the Apex2 project only using asp.net.I also want to display only the users and groups of Active Directory registered with the Apex2 project only. And I also want to add active directory users from whole AD list to our project's AD list. Can you please tell me, how will I do this. Shall I create an Organizational Unit and maintain all users and groups there for our project? Or, is there any other way to do this?  please help me.Thank You
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend