Support
Joined: 18 Jul 2005 Posts: 731
|
Posted: Tue Apr 21, 2009 12:00 pm Post subject: HOWTO: Always show extensions for files irrespective of the OS setting |
|
|
FolderView follows the "Hide File Extensions for Known File Types" setting in Windows Explorer - if it is ON, FolderView hides the extension of a file (for example, 'notes.txt' is displayed as simply 'notes').
To force FolderView to always show the extension irrespective of the OS setting, use the following code in the OnAfterNodeAdd event:
[C++]
Code: | void CFldrViewVCDlg::OnOnAfterNodeAddFolderviewctrl1(LPDISPATCH Node)
{
CTreeNode node;
node.AttachDispatch(Node,FALSE);
// Only show extensions for non-folders belonging to the file-system
AttributeTypes attr = (AttributeTypes)node.Attributes(FileSys| Folder);
if((attr & FileSys)!=0 && (attr & Folder)==0)
{
node.SetText(node.GetDisplayNameEx(FOVForParsing | FOVInFolder));
}
} |
[VB6]
Code: | Private Sub fldrVw_OnAfterNodeAdd(ByVal Node As FolderViewControl.ITreeNode)
' Only show extensions for non-folders belonging to the file-system
Dim attr As AttributeTypes
attr = Node.Attributes(AttributeTypes.FileSys Or AttributeTypes.Folder)
If (((attr And AttributeTypes.FileSys) <> 0) And ((attr And AttributeTypes.Folder) = 0)) Then
Node.Text = Node.GetDisplayNameEx(FOVDisplayNameFlags.FOVForParsing Or FOVDisplayNameFlags.FOVInFolder)
End If
End Sub |
|
|