CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    May 2006
    Location
    Mumbai, India
    Posts
    292

    getting Folder Options-> View settings

    Hello,

    Is there any API using which I can get the the Folder Options for the any folder??
    for example: how to retrive whether this is checked or not

    Folder Options->View-> Hide extensions for know types

    I am avoiding the use of registry as the key values may chage from version to version.

    Thanks in advance.

  2. #2
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,284

    Re: getting Folder Options-> View settings

    Yes, there is an API that you can use for this. The API you can use is named SHGetSettings and the Flag you would need to test with this API is named SSF_SHOWEXTENSIONS.

    Here is more info :
    http://msdn2.microsoft.com/en-us/library/ms647810.aspx
    Last edited by HanneSThEGreaT; August 6th, 2007 at 06:40 AM. Reason: More Info

  3. #3
    Join Date
    May 2006
    Location
    Mumbai, India
    Posts
    292

    Re: getting Folder Options-> View settings

    Thanks a lot
    That was working for me...

    One little issue. here is how I called the API

    Code:
    LPSHELLFLAGSTATE lpsfs = new SHELLFLAGSTATE(); 
    SHGetSettings(lpsfs,SSF_SHOWEXTENSIONS);
    if(lpsfs->fShowExtensions == FALSE )
    {
    ......
    }
    delete lpsfs;
    but I found that fShowExtensions is not TRUE/FALSE.
    instead its value is 0 when checked and -1 when unchecked...
    Why it is so??

    Thanks again,

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: getting Folder Options-> View settings

    By definition :
    FALSE is defined as 0 (zero);
    True is defined as NOT FALSE which means "any value not equal zero"!
    In your case the value is NOT FALSE (not zero) - means TRUE.
    Victor Nijegorodov

  5. #5
    Join Date
    May 2006
    Location
    Mumbai, India
    Posts
    292

    Re: getting Folder Options-> View settings

    Hi Victor,

    This is what I found in windef.h header file

    Code:
    #ifndef FALSE
    #define FALSE               0
    #endif
    
    #ifndef TRUE
    #define TRUE                1
    #endif
    Also lpsfs->fShowExtensions is of type BOOL.
    which is again define as int.
    But API should always set the values to TRUE or FALSE.

    Isnt it so..?

  6. #6
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,284

    Re: getting Folder Options-> View settings

    Quote Originally Posted by sachin871
    But API should always set the values to TRUE or FALSE.
    Isnt it so..?
    No. Not always.

  7. #7
    Join Date
    May 2006
    Location
    Mumbai, India
    Posts
    292

    Re: getting Folder Options-> View settings

    Ok!

    I aggree with u both...
    Didnt go throught the documentation properly..
    It reads

    fShowExtensions
    Nonzero if the Hide File Extensions for Known File Types option is disabled, or zero otherwise.


    Anyways,
    Thanks for the help!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured