Shell Constants, Enumeratio ...


FILETYPEATTRIBUTEFLAGS

Indicates FILETYPEATTRIBUTEFLAGS constants that are used in the EditFlags value of a file association PROGID registry key.

Constants

FTA_Exclude (0x00000001)
Excludes the file type.
FTA_Show (0x00000002)
Shows file classes, such as folders, that are not associated with a file name extension.
FTA_HasExtension (0x00000004)
Indicates that the file type has a file name extension.
FTA_NoEdit (0x00000008)
Prohibits editing of the registry entries associated with this file type, the addition of new entries, and the deletion or modification of existing entries.
FTA_NoRemove (0x00000010)
Prohibits deletion of the registry entries associated with this file type.
FTA_NoNewVerb (0x00000020)
Prohibits the addition of new verbs to the file type.
FTA_NoEditVerb (0x00000040)
Prohibits the modification or deletion of canonical verbs such as open and print.
FTA_NoRemoveVerb (0x00000080)
Prohibits the deletion of canonical verbs such as open and print.
FTA_NoEditDesc (0x00000100)
Prohibits the modification or deletion of the description of the file type.
FTA_NoEditIcon (0x00000200)
Prohibits the modification or deletion of the icon assigned to the file type.
FTA_NoEditDflt (0x00000400)
Prohibits the modification of the default verb.
FTA_NoEditVerbCmd (0x00000800)
Prohibits the modification of the commands associated with verbs.
FTA_NoEditVerbExe (0x00001000)
Prohibits the modification or deletion of verbs.
FTA_NoDDE (0x00002000)
Prohibits the modification or deletion of the entries related to Dynamic Data Exchange (DDE).
FTA_NoEditMIME (0x00008000)
Prohibits the modification or deletion of the content type and default extension entries.
FTA_OpenIsSafe (0x00010000)
Indicates that the file type's open verb can be safely invoked for downloaded files.
FTA_AlwaysUnsafe (0x00020000)
Prevents the Never ask me check box from being enabled. The user can override this attribute through the File Type dialog box.
FTA_AlwaysShowExt (0x00040000)
Causes the file type's file name extension to be always shown, even if the user has selected the Hide extensions for known file types option.
FTA_NoRecentDocs (0x00100000)

Prohibits the addition of members of this file type to the Recent Documents folder. Additionally, in Windows 7 and later, prohibits the addition of members of this file type to the automatic Recent or Frequent category of an application's Jump List.

This flag does not restrict members of this file type from being added to a custom Jump List. It also places no restriction on the file type being added to the automatic Jump Lists of other applications in the case that other applications use this file type.

Remarks

These flags represent possible attributes stored in the EditFlags value of a ProgID registration. The EditFlags data is a single REG_DWORD.

The following example shows the FTA_NoRemove (0x00000010) and FTA_NoNewVerb (0x00000020) attributes assigned to the .myp file type.

HKEY_CLASSES_ROOT
     .myp
          (Default) = MyProgram.1
     MyProgram.1
          (Default) = MyProgram Application
          EditFlags = 0x00000030

APIs such as IQueryAssociations::GetData can retrieve that EditFlags data. Compare these FILETYPEATTRIBUTEFLAGS flags against that retrived value to determine which flags are set.

The following example demonstrates the use of IQueryAssociations::GetData to determine if those values are set.

IQueryAssociations *passoc;

HRESULT hr = AssocCreate(CLSID_QueryAssociations, IID_PPV_ARGS(&passoc));
if (SUCCEEDED(hr))
{
    hr = passoc->Init(NULL, pszType, NULL, NULL);
    if (SUCCEEDED(hr))
    {
        DWORD dwEditFlags;
        ULONG cb = sizeof(dwEditFlags);
        
        hr = passoc->GetData(NULL, ASSOCDATA_EDITFLAGS, NULL, &dwEditFlags, &cb);
        if (SUCCEEDED(hr))
        {
            if (dwEditFlags & FTA_NoRemove)
            {
                // ...
            }    
            if (dwEditFlags & FTA_NoNewVerb)
            {
                // ...
            }
        }
    }
    passoc->Release();
}

To set an EditFlags attribute, you can use the RegSetValueEx or SHSetValue functions. First use IQueryAssociations::GetData to retrieve the current set of attributes as shown in the example above, add the desired FILETYPEATTRIBUTEFLAGS to that value, then write that value back to the registry using one of the two set functions.

Tags :


Page view tracker