473,587 Members | 2,489 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

.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\Windo ws\CurrentVersi on\Explorer\Adv anced\HideFileE xt)?
Apr 13 '07 #1
3 2356
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_SHOWEXTENSI ONS 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_SHOWEXTENSI ONS 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_SHOWEXTENSI ONS );
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
3727
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 I would like to work with string $sys. However, in the place where the "system()" is executed, php-file print on screen result of the
4
19374
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 from the image. I can subsequently display the JPG image itself, but the thumbnail creation fails. I have tried this with hundreds of other images...
2
2209
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 = false). However, when I have the bottom one in that column to be the one to be used
5
2181
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 Framework 1.1 then reinstall, unfortunately this seems to have done nothing. I've tried calling aspnet_regiis in a number of ways but that seems to...
4
9708
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 the expected extension is not returned. I can write another function to get around this, but if there is a clean way to determine the state of...
1
6452
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 following error: Unable to create the web 'http://MyWebServer/MyWebSite'. Server error: the server extensions were unable to access the file...
4
3102
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); Response.AddHeader("Content-Length", downloadFile.Length.ToString()); Response.ContentType = "application/octet-stream";
3
3685
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 this programmatically or by using NetBeans? Thank you for your help. Akino.
1
9068
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 which goes like this: This field name is not known. Error in File...
0
7852
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...
0
8216
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. ...
0
8349
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...
1
7974
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...
0
8221
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6629
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...
0
5395
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3845
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...
0
1192
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.