473,506 Members | 16,201 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Get application associated with a file extension (registry?)

We use this code to open files such as doc, pdf and html in it's
associated applications, "FileName" is something like
"C:\......\foo.pdf" or "C:\.......\foo.doc".

objProcess = New System.Diagnostics.Process
objProcess.StartInfo.FileName = FileName
objProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal
objProcess.StartInfo.UseShellExecute = True
objProcess.Start()

It worked fine until we noticed that opening and closing some certain
form in our application and then lauching pdf or doc or whatever in
Microsoft apps (IE, Word) causes terrible lags (10-20 seconds!). I
really have no idea, why is that so (lauching through Adobe Acrobat,
Mozilla Firefox works fine, it seems to be a problem in some Microsoft
libraries).

Anyway, we figured out that giving the full path to an application and
the document filename as argument works well, the problem is _how to get
the path to app associated with an extension ?_
I looked a little how the registry is organised, but was hoping someone
has an already tested routine :)

--
Adam Nowotny
JID: daft[at]chrome[dot]pl
GnuPG key 0x42D56D98 at hkp://blackhole.pca.dfn.de

Nov 21 '05 #1
1 4030
* Adam Nowotny <ad**@logosoft.pl> scripsit:
We use this code to open files such as doc, pdf and html in it's
associated applications, "FileName" is something like
"C:\......\foo.pdf" or "C:\.......\foo.doc".
[...]
Anyway, we figured out that giving the full path to an application and
the document filename as argument works well, the problem is _how to
get the path to app associated with an extension ?_


PInvoke on 'FindExecutable':

\\\
Private Declare Auto Function FindExecutable Lib "shell32.dll" ( _
ByVal lpFile As String, _
ByVal lpDirectory As String, _
ByVal lpResult As System.Text.StringBuilder _
) As Int32
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #2

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

Similar topics

6
2188
by: Jesper. | last post by:
Know of any good tutorials to demonstrate how to assign a file extension to an applicatiand and how to open the file in the application when you doubleclick on the file in the OS brgds Jesper.
13
4929
by: David Rose | last post by:
Hi, I am trying to launch pdf files (in this case). The test application takes the path to the pdf from a TextBox when the user clicks a button. I have written code that works on my computer,...
2
2152
by: Matthias S. | last post by:
Hi, I need to find the Icons associated with a given file extension. I guess there are registry entries for that. Is there a generic way of getting them? Thanks a lot in advance, Matthias
5
32713
by: GrantS | last post by:
Hi I am trying to use ShellExecute to launch an application to display a certain file. The variation on the theme is that I need to be able to specify the application to launch and not simply...
1
1391
by: QZ | last post by:
I have a proprietary application "A" and a proprietary file extension *.xyz. If I double click on the file filename.xyz, it will be opened by application "A". My question is how to do that through...
7
8056
by: Shane Story | last post by:
I want to be able to get the icon associated with a certain file extension. I can read the registry hkey_classes to get the ext. then look to the other key for default icon. How can I then...
1
2155
by: Brian Henry | last post by:
Just thought maybe someone here would like to know this. It's an example code I just created quickly on how to figure out the name of a type of file based on its extension (say for example .DOC)...
5
6666
by: =?Utf-8?B?TG9hbldvbGY=?= | last post by:
I'm working on a Windows Explorer-like application. What is the best way to find out what application is set to open a particular type of file? Is there a function to do this? Do I have to go...
1
3950
by: Sasie7679 | last post by:
We have a requirement to display all registered file extensions and there associated exe path. I can retreive the registered file extensions using "RegEnumKey" API by enumerating "HKEY_CLASSES_ROOT"...
0
7220
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
7105
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
7371
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...
1
7023
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...
0
7479
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...
0
5617
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,...
1
5037
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...
0
4702
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...
0
410
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.