473,387 Members | 1,520 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,387 software developers and data experts.

.NET and "hide extensions for known file types"


Anyone know of a proper .NET way to get the state of the user's "hide
extensions for known file types" setting? Or should I read the value
from the Registry directly
(HKCU\Software\Microsoft\Windows\CurrentVersion\Ex plorer\Advanced\HideFileExt)?
Apr 13 '07 #1
3 2350
Richard,
>Anyone know of a proper .NET way to get the state of the user's "hide
extensions for known file types" setting?
I'm not sure you can call it a ".NET way", but there's a native API to
retrieve these settings called SHGetSettings (use the
SSF_SHOWEXTENSIONS flag).

http://msdn.microsoft.com/library/en...etsettings.asp
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Apr 14 '07 #2
On Sat, 14 Apr 2007, Mattias Sjögren wrote:
I'm not sure you can call it a ".NET way", but there's a native API to
retrieve these settings called SHGetSettings (use the
SSF_SHOWEXTENSIONS flag).
That sounds like a better way than reading the Registry. And probably
much less hassle than IShellDispatch4::GetSetting.

I see the SHELLFLAGSTATE struct that SHGetSettings uses is a 16-bit
group of bitfields. You can't do bitfields in C# / PInvoke, can you? I
would need to declare SHGetSettings with its first parameter as "out
UInt16" and do bitwise operations on the value, yes? Like so:

UInt16 u;
SHGetSettings( out u, SSF_SHOWEXTENSIONS );
bool bShowExt = ( ( u & 0x0002 ) != 0 );
Apr 14 '07 #3
>I would need to declare SHGetSettings with its first parameter as "out
UInt16" and do bitwise operations on the value, yes?
Correct.
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Apr 15 '07 #4

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

Similar topics

2
by: opt_inf_env | last post by:
Hallo, I want to see from php-file list of files which are in directory, where is the given php-file. To do so, I put in the php-file the following line: <?php $sys = system("ls") ?> Then...
4
by: Stephen Oakes | last post by:
I am trying to upload an image to a server, but I get this warning: Warning: imagecreatefromjpeg(): 'filename' is not a valid JPEG file The error occurs when I am trying to create a thumbnail...
2
by: | last post by:
I have a page where I have 3 combo boxes listed in a column. sort of like: combo1 combo2 combo3 Based on which one is clicked, the others are supposed to hide (i.e. combobox.visible =...
5
by: Nick | last post by:
Hi there, I despearately need to get IIS working with ASP.NET, but I still can't see any "Web Service Extensions". My previous question regarding this ended in the decision to uninstall .NET...
4
by: lcifers | last post by:
Is there a way, through VB.NET, to determine if the user has selected this option? I am writing an application that does some string functions to rename files, and the file names get chopped up if...
1
by: Terry Olsen | last post by:
I'm hoping someone can help me here. When trying to create a new web site with Visual Studio 2005, I choose HTTP and enter the url I want to create (http://MyWebServer/MyWebSite). But I get the...
4
by: L. Scott M. | last post by:
I am invoking a file download using the following code: Response.Clear(); Response.AddHeader("Content-Disposition", "attachment; filename=" + downloadFile.Name);...
3
by: Akino877 | last post by:
Hello, I am trying to user a File Chooser with DIRECTORIES_ONLY set. And I would like to be able to hide the "Files of type" label and the associated combo box. I wonder if there is a way to do...
1
by: arme9867 | last post by:
i am using a formula in my subreport which goes like this: 'datediff("h",{VEHICLE.jo_datetime_created},{VEHICLE.jo_datetime_released}) but when i try to run the system it has a run time error...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
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...

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.