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 -> FileView ActiveX Control
View previous topic :: View next topic  
Author Message
Support



Joined: 18 Jul 2005
Posts: 731

Posted: Tue Apr 21, 2009 11:56 am    Post subject: HOWTO: Always show extensions for files irrespective of the OS setting

FileView follows the "Hide File Extensions for Known File Types" setting in Windows Explorer - if it is ON, FileView hides the extension of a file (for example, 'notes.txt' is displayed as simply 'notes').

To force FileView to always show the extension irrespective of the OS setting, use the following code in the OnAfterItemAdd event:

[C++]
Code:
void CFilViewVCDlg::OnOnAfterItemAddFileviewctrl1(LPDISPATCH Item)
{
 CListItem item;
 item.AttachDispatch(Item,FALSE);

 // Only show extensions for non-folders belonging to the file-system
 AttributeTypes attr = (AttributeTypes)item.GetAttributes(FileSys| Folder);
 if((attr & FileSys)!=0 && (attr & Folder)==0)
 {
  item.SetText(item.GetDisplayNameEx(FIVForParsing | FIVInFolder)); 
 }
}


[VB6]
Code:
Private Sub fileVw_OnAfterItemAdd(ByVal Item As FileViewControl.IListItem)

' Only show extensions for non-folders belonging to the file-system
Dim attr As AttributeTypes
attr = Item.Attributes(AttributeTypes.FileSys Or AttributeTypes.Folder)

If (((attr And AttributeTypes.FileSys) <> 0) And ((attr And AttributeTypes.Folder) = 0)) Then
Item.Text = Item.GetDisplayNameEx(FIVDisplayNameFlags.FIVForParsing Or FIVDisplayNameFlags.FIVInFolder)
End If

End Sub
Back to top
Display posts from previous:   
Forum Index -> FileView ActiveX Control All times are GMT
Page 1 of 1

 
Jump to:  


Powered by phpBB © 2001, 2005 phpBB Group