473,769 Members | 6,653 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Display a files icon

Hello group

I'm developing a file application, but I have run into a problem that I hope
you can help with.

My application lists a number of files (names). Now I would like to display
the proper file icon before I display the file name. E.g. if it is a .doc
file, I would like to display the Microsoft Word icon.

The icon should depend on which program is associated with the file type.
Preferably the program that the web client computer has associated with the
file type. I only need something that works under Internet Explorer on
Windows.

Do you have any suggestions?

Regards
Anders
Nov 19 '05 #1
5 2547
Anders,

You need somehow to get access to Windows API. I heard of WSH API Toolkits
that make possible using Windows API from WSH objects. Try googling it.

Eliyahu

"Anders K. Olsen" <ak*****@hotmai l.com> wrote in message
news:e8******** ******@TK2MSFTN GP09.phx.gbl...
Hello group

I'm developing a file application, but I have run into a problem that I hope you can help with.

My application lists a number of files (names). Now I would like to display the proper file icon before I display the file name. E.g. if it is a .doc
file, I would like to display the Microsoft Word icon.

The icon should depend on which program is associated with the file type.
Preferably the program that the web client computer has associated with the file type. I only need something that works under Internet Explorer on
Windows.

Do you have any suggestions?

Regards
Anders

Nov 19 '05 #2
That's an interesting reply, Eli... I hadn't thought of that myself, and if
it works that'd be great. But as far as I've seen and know, it's always up
to you, the developer to associate the icons with the file extensions. You
can use an existing set of GIF images (which you can get from google images
:-)) and associate them. I've never seen anyone implement a complex
procedure just for this. Also, keep in mind that new Active Content blockers
in IE could prevent it from working. And it'd probably not work in FireFox
at all.

HTH
--------------------------------------------------------------------------------
All that glitters has a high refractive index.
www.mendhak.com
"Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message
news:OA******** ******@TK2MSFTN GP15.phx.gbl...
Anders,

You need somehow to get access to Windows API. I heard of WSH API Toolkits
that make possible using Windows API from WSH objects. Try googling it.

Eliyahu

"Anders K. Olsen" <ak*****@hotmai l.com> wrote in message
news:e8******** ******@TK2MSFTN GP09.phx.gbl...
Hello group

I'm developing a file application, but I have run into a problem that I

hope
you can help with.

My application lists a number of files (names). Now I would like to

display
the proper file icon before I display the file name. E.g. if it is a .doc
file, I would like to display the Microsoft Word icon.

The icon should depend on which program is associated with the file type.
Preferably the program that the web client computer has associated with

the
file type. I only need something that works under Internet Explorer on
Windows.

Do you have any suggestions?

Regards
Anders


Nov 19 '05 #3
If I understood the OP correctly, the whole point is to show the icons that
are associated with the extensions on the client machine. That might be
possible only with Windows API. Note, that I am no more than guessing, I
never did anything like this myself. And the OP cares only about IE in
Windows.

Anyway, it does look that the solution is too complex for the task.

Eliyahu

"S.M. Altaf [MVP]" <sm*****@PLEASE DONTSPAMMEmsn.c om> wrote in message
news:OQ******** ******@TK2MSFTN GP12.phx.gbl...
That's an interesting reply, Eli... I hadn't thought of that myself, and if it works that'd be great. But as far as I've seen and know, it's always up to you, the developer to associate the icons with the file extensions. You can use an existing set of GIF images (which you can get from google images :-)) and associate them. I've never seen anyone implement a complex
procedure just for this. Also, keep in mind that new Active Content blockers in IE could prevent it from working. And it'd probably not work in FireFox at all.

HTH
-------------------------------------------------------------------------- ------ All that glitters has a high refractive index.
www.mendhak.com
"Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message
news:OA******** ******@TK2MSFTN GP15.phx.gbl...
Anders,

You need somehow to get access to Windows API. I heard of WSH API Toolkits that make possible using Windows API from WSH objects. Try googling it.

Eliyahu

"Anders K. Olsen" <ak*****@hotmai l.com> wrote in message
news:e8******** ******@TK2MSFTN GP09.phx.gbl...
Hello group

I'm developing a file application, but I have run into a problem that I

hope
you can help with.

My application lists a number of files (names). Now I would like to

display
the proper file icon before I display the file name. E.g. if it is a ..doc file, I would like to display the Microsoft Word icon.

The icon should depend on which program is associated with the file type. Preferably the program that the web client computer has associated with

the
file type. I only need something that works under Internet Explorer on
Windows.

Do you have any suggestions?

Regards
Anders



Nov 19 '05 #4
I agree with Altaf. The way I've done this in the past is get a bunch of
images from various sources (google, screen capture) name them something
like doc.gif jpg.gif pdf.gif and then simply display <extension>.g if

<img src="<%#
System.IO.Path. GetExtension(Da taBinder.Eval(C ontainer.DataIt em,
"Filename"))%>. gif " />

I actually had an unknown.gif, did a File.Exists("xx x.gif") cached the
resutls and voila..

karl
--
MY ASP.Net tutorials
http://www.openmymind.net/

"Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message
news:uF******** ******@TK2MSFTN GP09.phx.gbl...
If I understood the OP correctly, the whole point is to show the icons
that
are associated with the extensions on the client machine. That might be
possible only with Windows API. Note, that I am no more than guessing, I
never did anything like this myself. And the OP cares only about IE in
Windows.

Anyway, it does look that the solution is too complex for the task.

Eliyahu

"S.M. Altaf [MVP]" <sm*****@PLEASE DONTSPAMMEmsn.c om> wrote in message
news:OQ******** ******@TK2MSFTN GP12.phx.gbl...
That's an interesting reply, Eli... I hadn't thought of that myself, and

if
it works that'd be great. But as far as I've seen and know, it's always

up
to you, the developer to associate the icons with the file extensions.

You
can use an existing set of GIF images (which you can get from google

images
:-)) and associate them. I've never seen anyone implement a complex
procedure just for this. Also, keep in mind that new Active Content

blockers
in IE could prevent it from working. And it'd probably not work in

FireFox
at all.

HTH
--------------------------------------------------------------------------

------
All that glitters has a high refractive index.
www.mendhak.com
"Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message
news:OA******** ******@TK2MSFTN GP15.phx.gbl...
> Anders,
>
> You need somehow to get access to Windows API. I heard of WSH API Toolkits > that make possible using Windows API from WSH objects. Try googling it.
>
> Eliyahu
>
> "Anders K. Olsen" <ak*****@hotmai l.com> wrote in message
> news:e8******** ******@TK2MSFTN GP09.phx.gbl...
>> Hello group
>>
>> I'm developing a file application, but I have run into a problem that
>> I
> hope
>> you can help with.
>>
>> My application lists a number of files (names). Now I would like to
> display
>> the proper file icon before I display the file name. E.g. if it is a .doc >> file, I would like to display the Microsoft Word icon.
>>
>> The icon should depend on which program is associated with the file type. >> Preferably the program that the web client computer has associated
>> with
> the
>> file type. I only need something that works under Internet Explorer on
>> Windows.
>>
>> Do you have any suggestions?
>>
>> Regards
>> Anders
>>
>>
>
>



Nov 19 '05 #5
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:u4******** ******@tk2msftn gp13.phx.gbl...
I agree with Altaf. The way I've done this in the past is get a bunch of
images from various sources (google, screen capture) name them something
like doc.gif jpg.gif pdf.gif and then simply display <extension>.g if

<img src="<%#
System.IO.Path. GetExtension(Da taBinder.Eval(C ontainer.DataIt em,
"Filename"))%>. gif " />

I actually had an unknown.gif, did a File.Exists("xx x.gif") cached the
resutls and voila..


I was hoping that I could avoid doing that. Considering that Windows already
knows the proper icon, I was hoping that I could persuade Windows to give me
the information.

I found this page on the internet:

http://www.codeproject.com/aspnet/As...IconsImage.asp

I haven't tested it yet, but I intend to take a look at it soon. As far as I
can see, it uses the SHGetFileInfo Shell32 API call. This will hopefully
make it possible to get the icon for the file type as seen from the server.

I will let you know if I can get it to work.

If anybody else know of a better solution, please let me know.

Regards
Anders
Nov 19 '05 #6

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

Similar topics

6
6201
by: Sandman | last post by:
I'm having some problem here... I have a javascript I've downloaded that goes through all PNG files and enables the transparency channel in them for IE5.5+ by converting them to SPAN layers with the image as background. This works great until I put one of these PNG files inside a display:none block and later sets the block to display:block - then the SPAN (that was the PNG <img>) remains hidden.
5
1991
by: Martin Moser | last post by:
Does somebody knows, if theres a way to display any file (tiff, doc, pdf, .....) "inline" on an asp.net site? What I want to do is, to display a file, which is stored in the DB, and some information around it. If you know a way, or a third party control, please let me know. tia Martin
2
6699
by: active | last post by:
I find Bitmap.Save works for WMF files but Bitmap.FromFile does not. If I use FromFile on a WMF file that came with VS I get an exception. If I use it on a WMF file created with Bitmap.Save I don't get an exception but it appears the Bitmap is blank. Can anyone share some knowledge on this?
8
1489
by: Dinesh Jain | last post by:
Hi al,, I have written a code which displays directory listing of files from FTP server directory.I display all the files in a listview with its associated icons. To display icons, I get the resouce file name and it's index by searching from the Registry entries. I use ExtractIconsEx() Win32API to extract icon from exe or dll by specifying it's index. I get this error more frequently when I minimize/maximize the window which displays...
5
1588
by: jcrouse | last post by:
I saw an article, once, on how to package image file in the installer so they are not accessible to the end user. I want to say hidden, but I don't just mean the file attribute of the image file. Does anyone know of the article I'm speaking of or a link on how to embed (another poor choice of words) the image files in the executable? Thanks, John
2
19875
by: Mamatha | last post by:
Hi I want to add an icon to the textbox's text. I don't know how to display icon in textbox in VB.NET. If any one knows please let me know. Thanks in advance. Mamatha
13
2081
by: Lou | last post by:
if I add a new item (Solution Items) to my project and its an icon(.ico), how can I reference that file when I am coding, Do I have to also add it to an image control, I don't want the file to be part of the .resx file. Its like VB6 when I could use load all my images from a resource file. Lou
5
1828
by: Ron Hinds | last post by:
OK, I know this isn't an ASP question. But I'm hoping someone here knows the answer. How do I get *my* icon to display in the address bar instead of the standard browser's icon, like e.g. on the MSDN website? Also, I'd like to add a link to create a desktop shortcut to my website using said icon. Anyone? Thanks!
3
5942
by: Ian | last post by:
I have a form with a sub form, on the continues sub for I want to display some data along with a picture, on the On Current event I have the code: .Picture = Nz() is the name of the picture control, is the name of the text field that holds the path to the jpg. What I want is each record in the sub form to show the associated
0
9589
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10216
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10049
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9997
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
8873
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...
0
5309
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
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3565
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.