Sky Software Homepage LogicNP Software Knowledge Base And FAQ

 
Contact Product Support    SearchSearch      Subscribe to the RSS feed for this forum

HOWTO: Always show extensions for files irrespective of the OS setting

 
Subscribe to the RSS feed for this forum  Forum Index -> FolderView ActiveX Control
View previous topic :: View next topic  
Author Message
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
Back to top
Display posts from previous:   
Forum Index -> FolderView ActiveX Control All times are GMT
Page 1 of 1

 
Jump to:  


Powered by phpBB © 2001, 2005 phpBB Group