473,406 Members | 2,390 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,406 software developers and data experts.

Determining the application currently associated w/ file type...

I'm writing an application where then end-user will want to view and print
(not edit) TIFF and JPEG images. For now, I simply use the
System.Diagnostics.Process.Start method to open the desired image with the
application currently associated with that file type.

However, sometimes the wrong application is associated with a file type.
For example, Microsoft Office Picture Manager will only display the first
page of a multi-page TIFF image with no way to view the additional pages
(that I know of). Also, I suspect it may be possible that some older
machines running Windows ME or Windows 98 may not have an application
associated with TIFF images.

So, I'd like to check on the current application associated with TIFF
images. What is the best way to go about doing that?

Any advice or suggestions are greatly appreciated.

Thanks,

Carl
Nov 21 '05 #1
1 1560
On Fri, 22 Jul 2005 10:19:17 -0700, "Vagabond Software" <vagabondsw-X-@-X-gmail.com> wrote:

¤ I'm writing an application where then end-user will want to view and print
¤ (not edit) TIFF and JPEG images. For now, I simply use the
¤ System.Diagnostics.Process.Start method to open the desired image with the
¤ application currently associated with that file type.
¤
¤ However, sometimes the wrong application is associated with a file type.
¤ For example, Microsoft Office Picture Manager will only display the first
¤ page of a multi-page TIFF image with no way to view the additional pages
¤ (that I know of). Also, I suspect it may be possible that some older
¤ machines running Windows ME or Windows 98 may not have an application
¤ associated with TIFF images.
¤
¤ So, I'd like to check on the current application associated with TIFF
¤ images. What is the best way to go about doing that?
¤
¤ Any advice or suggestions are greatly appreciated.

You can use the FindExecutable API function call:

Declare Function FindExecutable Lib "shell32.dll" Alias "FindExecutableA" (ByVal lpFile As
String, _
ByVal lpDirectory As
String, _
ByVal lpResult As
System.Text.StringBuilder) As Int32

Function FindAssociatedApp(ByVal FullFilePath As String) As String

Dim FileDir As String

Dim FileExecutablePath As New System.Text.StringBuilder(255)

If FindExecutable(FullFilePath, FileDir, FileExecutablePath) > 32 Then
Return (FileExecutablePath.ToString)
End If

End Function
FileExecutablePath = FindAssociatedApp("e:\My Documents\book1.xls")

Paul
~~~~
Microsoft MVP (Visual Basic)
Nov 21 '05 #2

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

Similar topics

3
by: Jenkins | last post by:
I have a page with frames. The left frame is a list of urls. The main frame is loaded based on the url that was clicked in the left frame. Is there a way for the main frame to tell which url was...
1
by: RWC | last post by:
Hi Folks, I'm looking for a way to determine if the client machine has access installed and if so, what version. The reason I need this is to determine (programatically) if the Access Runtime...
1
by: Funk | last post by:
Hi, I am currently creating a system that will support web based research. The idea is that the researcher is able to use Internet Explorer or Mozilla, or whichever browser to search for...
6
by: Kenneth Courville | last post by:
Hello, I'm looking for assistance with the Access object model. I know this is VB, but I'm building an Office Add-using C# directed at Access 2002. I'm literate in VB, so you can reply in VB... I...
2
by: Stephen Walch | last post by:
I have seen many examples on the web for downloading attachments ffrom ASP.NET forms using response.WriteBinary, but they all use hard-coded ContentTypes (for example, Response.ContentType =...
2
by: david | last post by:
I have a basic problem about MS. I can not change the associated application with file type. I have done the following. go Tools -->Folder Options-->File Types. However, the buttons such as New,...
2
by: Robert | last post by:
I have an application migrated from 1.1 to 2.0 via VS2005. Under 1.1 I could do the following to return the version information (as found in the assemblyinfo.vb file) GetVersion =...
0
by: bloggs | last post by:
I am writting an application that runs on an FTP server. The purpose of the app is to uncompress gzip files that are sent to the server and then move the file to another folder according to it's...
3
by: Larry Hunt | last post by:
I am developing a class which will be used in both a WinForm and ASP.NET 2.0 application. The class needs to know which type of application it is running in. How do you programmatically determine...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
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
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
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...

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.