473,503 Members | 1,654 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 2536
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*****@hotmail.com> wrote in message
news:e8**************@TK2MSFTNGP09.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.com> wrote in message
news:OA**************@TK2MSFTNGP15.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*****@hotmail.com> wrote in message
news:e8**************@TK2MSFTNGP09.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*****@PLEASEDONTSPAMMEmsn.com> wrote in message
news:OQ**************@TK2MSFTNGP12.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.com> wrote in message
news:OA**************@TK2MSFTNGP15.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*****@hotmail.com> wrote in message
news:e8**************@TK2MSFTNGP09.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>.gif

<img src="<%#
System.IO.Path.GetExtension(DataBinder.Eval(Contai ner.DataItem,
"Filename"))%>.gif " />

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

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

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:uF**************@TK2MSFTNGP09.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*****@PLEASEDONTSPAMMEmsn.com> wrote in message
news:OQ**************@TK2MSFTNGP12.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.com> wrote in message
news:OA**************@TK2MSFTNGP15.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*****@hotmail.com> wrote in message
> news:e8**************@TK2MSFTNGP09.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**************@tk2msftngp13.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>.gif

<img src="<%#
System.IO.Path.GetExtension(DataBinder.Eval(Contai ner.DataItem,
"Filename"))%>.gif " />

I actually had an unknown.gif, did a File.Exists("xxx.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
6187
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...
5
1974
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...
2
6674
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...
8
1478
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...
5
1579
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....
2
19815
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
2056
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...
5
1816
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...
3
5888
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...
0
7072
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
7271
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
7319
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
6979
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
7449
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
5570
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,...
0
3160
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...
0
3149
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
373
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.