|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
type of file from extension but no filenameI want to get a list of file types from a big list of extensions. I know there exists an api call (see below), but it only works when you have a file name. SHGetFileInfo(FileName, 0, shinfo, Marshal.SizeOf(shinfo), SHGFI_TYPENAME) Return shinfo.szTypeName But this only works when passing an actuual filename (fe: "C:\WINDOWS\WIN.INI") When getting the icon from only the extension seems to work: hImgLarge = SHGetFileInfo(ext, 0, shinfo, Marshal.SizeOf(shinfo), SHGFI_USEFILEATTRIBUTES Or SHGFI_ICON Or SHGFI_LARGEICON) Return System.Drawing.Icon.FromHandle(shinfo.hIcon) Here I can pass the extension only (fe: ".exe") Is this possible? Grtz.
Show quote
Hide quote
>I want to get a list of file types from a big list of extensions. The key is to specify SHGFI_USEFILEATTRIBUTES like you did for the> >I know there exists an api call (see below), but it only works when you have >a file name. >SHGetFileInfo(FileName, 0, shinfo, Marshal.SizeOf(shinfo), SHGFI_TYPENAME) >Return shinfo.szTypeName > >But this only works when passing an actuual filename (fe: >"C:\WINDOWS\WIN.INI") > > >When getting the icon from only the extension seems to work: >hImgLarge = SHGetFileInfo(ext, 0, shinfo, Marshal.SizeOf(shinfo), >SHGFI_USEFILEATTRIBUTES Or SHGFI_ICON Or SHGFI_LARGEICON) >Return System.Drawing.Icon.FromHandle(shinfo.hIcon) > >Here I can pass the extension only (fe: ".exe") icon. Should work for the file type as well. Mattias -- Mattias Sjögren [C# MVP] mattias @ mvps.org http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com Please reply only to the newsgroup.
How to run scheduler for more than one time in a day
2 dimensional array-->1 dimensional array Help with deleting a Row in a database Datagrid - recognizing changes made Download a file from a secured Https Server FTP routines programmed by VB .net SharpDevelop vs M'soft IDE textbox currency VS 2005 Form Appearance / "Theme" Check File Permissions and Usage |
|||||||||||||||||||||||