By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,234 Members | 1,850 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,234 IT Pros & Developers. It's quick & easy.

Get application associated with a file extension (registry?)

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
* 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 discussion thread is closed

Replies have been disabled for this discussion.