Home of Shell MegaPack : Windows Explorer-Like File & Folder Browser Controls & Components For .Net & ActiveX

Categories

Installation
Deployment and distribution
Licensing and registration
Usage in web development
Customization ( custom icons, custom displaytexts, custom items, etc.)
Behavior control ( e.g. prevent opening of files)
Filtering ( e.g. show only files)
General - programmatic control

*In this guide the terms folder, file, ListItem and item are used interchangeably.


Installation

How can my development project start using a new version of the control ?

After you install a new version of FileView ActiveX Control, applications you have developed do not retain their saved properties and licensing information. To use the new version properly in your applications, you should perform the following steps :

1. Delete and reinsert the control on the form(and give the reinserted control the original name, so that your code continues to work).
2. Set the properties of the control to your original properties.
3. Rebuild the development project ( The control will not save properties properly if you just issue the build command; you have to issue the Rebuild All command ).


How can I register the FileView ActiveX Control on my system?

Before any ActiveX control can be used, proper information about the control must be entered in the system registry. This process is called as 'registering' the control. Normally FileView ActiveX Control is automatically registered on your system, when you install it. If you need to register the control again, for example if it becomes unregistered for some reason and you cannot see it in the 'Insert ActiveX Control' dialog box, then you can just reinstall the control again. Alternatively you can quickly register the control by dragging and dropping the filevw70.ocx file on the regsvr32.exe file that is present in the Windows System directory.


Deployment and distribution

What are the procedures for distributing FileView ActiveX Control with my application?

An application which uses FileView ActiveX Control should distribute the file filevw70.ocx along with the dependencies listed above. No other information or files is necessary for distribution. The developer should make sure that the control is registered in the system registry on the end-users' machines. Registration of the control is done automatically by many installation builders during installation of your program, or you can do the registration yourself during the installation of your program. The redistributable file regsvr32.exe can be used for control registration. This registration is required for every ActiveX control to run on a machine.

Note that the above registration is different from 'registering the control', that is entering the registration codes ( username and code ) after you have purchased the control. This registration should only be done on the developers' machines after you have purchased the licenses for the control. Under no circumstances should the developer make available to the end-user or their systems, the sensitive registration and licensing information ( username and codes ) either explicitly or implicitly. Please read the License Agreement for further information. The FileView ActiveX Control handles registration and licensing by embedding the developer's license information in the application. When this application is run, this information is automatically retrieved and verified if the control is licensed.

The end-users of my program get one of the following error messages when they run the program :
"Runtime error 429: you don't have the appropriate license to use this functionality"
"Run-time error '13': Type mismatch"

This problem can occur if your program uses FileView v4.3 or earlier, because all these versions of FileView had the same GUID and a filename of fileview.ocx. The problem occurs because the different versions of FileView are not binary compatible with each other. Your program might be compiled with one version of FileView and the end-user might have a different version. This can happen if the end-user installs another program which uses a different versions of FileView. In this case, the version of FileView that comes with the other program will replace the one that your program uses.

Till version 4.3, all versions of FileView had the same GUID and a filename of fileview.ocx. However, starting with version 5.0, each version has a different GUID and filename ( e.g. v5.0 has a filename of filevw50.ocx ). This ensures that multiple versions of FileView can coexist on the same machine.

Therefore, if your program uses FileView v5.0 or above, then you wont have this problem. However, if your program uses earlier versions, then the only way to solve the problem on the end-user's machine is to make sure that his machine has only one version of FileView installed and that version is the same version that your program uses. To ensure that the end-user has the correct version he should search all his hard disks for fileview.ocx and filevw*.ocx and unregister ( using regsvr32.exe ) and remove all such instances. Then he should reinstall your program.


Licensing and registration

How can I enter license information in the FileView ActiveX Control after I have purchased a license?

After you have purchased the FileView ActiveX Control, you will receive a username and registration codes for the control. To register the control, follow these steps..

  • Right-click on the control in design-mode, i.e. when the control is on the form-designer and then select 'Activate License..'.
  • Enter the username and code exactly as you received it from LogicNP Software.

After the above steps are performed, there are still a few more steps that must be done before the control can use the registration information correctly and stop showing the About box. These steps are different for different development environments as described below :

  • Microsoft Visual Basic 6.0 : No additional steps are required
  • Microsoft Visual C++ 6.0 and Microsoft Visual C++.Net : Close and reopen the dialog resource on which the control is being used and change the position of the control ( and then hit undo if the position change is unwanted)
  • Microsoft Access 97/2000/XP : Delete and reinsert the control on the form(and give the reinserted control the original name, so that your code continues to work).
  • All other developing environments : Delete and reinsert the control on the form(and give the reinserted control the original name, so that your code continues to work).

Usage in web development

How can I use FileView ActiveX Control on an HTML or ASP page?

Beginning with version 4.3 the developer must use the LPKTool to use the control on an HTML or ASP page as described below (Before running the LPKTool the control must already be properly licensed on the developer's machine) :

  • Run the LPKTool which you can download from http://msdn.microsoft.com/downloads/Default.aspx (Search for the term "lpk" on this web page).
  • Select "LogicNP Software FileView ActiveX Control" from the list of the ActiveX Controls shown and then click on "Save and Exit" to save the license file. Specify control.lpk as the filename or you can specify your own filename.
  • In the HTML or ASP page that is using the control, add the following after the <BODY> start tag :

    <OBJECT CLASSID="clsid:5220CB21-C88D-11cf-B347-00AA00A28331">
    <PARAM NAME="LPKPath" VALUE="control.lpk">
    </OBJECT>


    The object tag shown above needs to precede any other object tags on your page. This tag loads the Microsoft license processor which manages licensed ActiveX controls on a web page.
  • Insert the ActiveX Control in the HTML or ASP page manually or using an HTML editor like Visual InterDev or Dreamweaver.

To have Internet Explorer automatically download the filevw70.ocx file on a target computer which doesn't have the file installed, you must package the filevw70.ocx file in a cab file and specify the cab file in the CODEBASE attribute of the fileview object tag as shown below :

<OBJECT
classid=clsid:43805286-DDA2-11D3-B3E7-EDC559154043 codebase="fileview.cab" height="300" id=FileView1 style="LEFT: 0px; WIDTH: 405px; TOP: 0px; HEIGHT: 255px" ></OBJECT>

To make a CAB file for filevw70.ocx, you will need the Cabinet SDK (downloadable from http://download.microsoft.com/download/platformsdk/cab/2.0/w98nt42kmexp/en-us/Cabsdk.exe )

After you have installed the Cabinet SDK, run the cabarc.exe tool that comes with it as follows :

cabarc.exe n fileview.cab filevw70.ocx

The above command line creates a new cabinet file named fileview.cab and adds filevw70.ocx to it.

 


Customization ( custom icons, displaytexts, items, etc.)

How can I display my own icons and texts to files/folders shown in FileView ActiveX Control?

You can display your own text or icons for files/folders shown in FileView.

To change the text shown for a ListItem, you should use the Text property. You can change this property for each node in the OnAfterItemAdd event which is called after each node is added.

item1.Text = item1.DisplayName + "*"

To change the icons shown for a ListItem, you should use the IconIndex property. You can change this property for each node in the OnAfterItemAdd event which is called after each node is added.

item1.IconIndex = 22

The above method allows you to display only those icons which are present in the system imagelist. If you want to display your own icons for nodes, then you should use the AddCustomIcon method. This method returns an index which you can then use with the IconIndex property.

Dim index as Integer
index= filevw.AddCustomIcon("c:\test.ico",Nothing)
item1.IconIndex = index


How can I change the font and colors used by FileView ActiveX Control?

You should use the Font, BackColor and TextColor properties to do so. You can change these properties at design time through the property-pages of the control.


How can I customize the underlying listview control?

You should use the BorderStyle, FlatScrollBar, FullRowSelect, HeaderSortArrowImageStyle, HotTracking, ShowGridLines and TrackSelect properties for customization.


How can I change the column name, column text justification or the column width in 'Details' view?

You should use the ColumnName, ColumnTextJustification and ColumnWidth properties.


How can I change the column text displayed for a file/folder in 'Details' view?

You should use the ColumnText property of ListItem.

For example if change the text in the Type column for a file/folder ....

item1.ColumnText("Type",0)="My custom filetype"


How can I display overlay icons for non-shortcut or non-network folders/files?

You should use the OverlayIconIndex property of ListItem.


How can show/hide the check box for individual items?

You should set the ShowCheckBox property of ListItem to True/False to show/hide the check box respectively.


How can I add custom columns in Report mode?

You should use the AddCustomColumn method. You can set the column text for individual items by using the ColumnText property of ListItem in the OnAfterItemAdd event or anytime after that.


How can I add custom contextmenu items in the contextmenu shown when a file/folder is right-clicked?

You should use the OnCustomContextMenuItemAdd event to add user-defined context menuitems. Then respond to the selection of the custom contextmenu item in the OnCustomContextMenuItemSelect event.


How can I add custom items in FileView?

You should use the AddCustomItem to add custom items.


How can I set a background image for FileView?

You should use the SetBackgroundImage method.



Behavior control ( e.g. prevent opening of files)

How can I prevent the user from changing the current folder?

You should set the AllowDiveIntoFolders property to False.


How can I prevent the user from opening files by double-clicking on them?

You should set the AllowFileExecution property to False.


How can I prevent the user from selecting multiple files/folders?

You should set the AllowMultipleSelection property to False.


How can I disable the default behavior of FileView ActiveX Control to keystrokes like 'Del' and 'Ctrl-C', etc.?

Just set the DefaultKeyHandling property to False.


How can I prevent the background menu from appearing when the user right-clicks on a blank area in the control?

You should set the ShowBackgroundMenu property to False.


How can I prevent context menus from appearing when a file/folder is right-clicked?

You should set the ShowContextMenus property to False.


How can I prevent a node from being checked/unchecked?

You should set the Cancel parameter to True in the OnItemCheck event.


How can I prevent certain columns from displaying in 'Details' view?

You should set the Add parameter to False in the OnBeforeColumnAdd event.


How can I prevent a specific file from opening or from going down into a certain folder?

You should set the Cancel parameter to True in the OnItemDblClick event.


How can I allow dragdrop only within FileView or only from FileView to an external window?

You should use the DragDropSettings property.


How can I prevent InfoTips from displaying when the mouse is held over a file or folder?

You should set the ShowInfoTips property to False.


How can I prevent an item from being selected?

You should set the Cancel parameter to True in the OnBeforeSelectionChange event.


How can I prevent certain shell commands (like Delete) from being executed on certain items?

You should set the Cancel parameter to True in the OnBeforeShellCommandExecute event.


How can I prevent certain items from being renamed?

You should set the Cancel parameter to True in the OnBeginItemRename event.


How can I prevent showing of contextmenu for certain items?

You should set the CancelEvent property to True in the OnItemRightClick event.


How can I prevent the display of or change the default infotips shown for files and folder?

You should use the OnGetInfoTip event.


How can I prevent a dragdrop operation from starting on a per-item basis or prevent a drop action on a per-item basis or change the default drop action (e.g. from copy to move)?

You should use the OnOleStartDrag, OnOleDragDrop and OnOleDragOver events.

 



Filtering ( e.g. show only files)

How can I allow only files of a certain extension to be shown in FileView?

You should use the FilePattern property.

For example to display only files of type txt and bmp, you should use this line of code
filevw.FilePattern = "*.txt;*.bmp"


How can I show only files in the FileView ActiveX Control?

You should set the ShowFolders property to False.


How can I prevent non-filesystem folders/files or hidden folders/files from displaying?

You should set the ShowSpecialFolders and ShowHiddenItems properties to False.


How can I prevent a certain item from displaying in FileView ActiveX Control?

You should use the Delete method of ListItem. A good place to call this method is in the OnAfterItemAdd event.



General

How can I determine the current folder for which FileView ActiveX Control is displaying contents?

You should use the CurrentFolder or the CurrentPidl properties. The CurrentFolder property returns the full path of the current folder and hence can only be used for fileystem folders. CurrentPidl can return the Pidl even for non-filesystem folders such as 'Control Panel'


How can I enumerate all the folders/files shown in FileView ActiveX Control?

To enumerate through all the nodes, you should use the ListItem property.

Dim x As FileViewControl.ListItem
For i = 1 To FileView1.ItemCount
Set x = FileView1.ListItem(i)
Debug.Print x.DisplayName
Next i


How can I enumerate all the selected folders/files shown in FileView ActiveX Control?

You should use the FirstSelectedItem and NextSelectedItem properties to do so.

Dim x As FileViewControl.ListItem
Set x = FileView1.FirstSelectedItem
While x Is Nothing = False
Debug.Print x.DisplayName
Set x = FileView1.NextSelectedItem
Wend


How can I determine the total number of items and total number of selected items in FileView?

You should use the ItemCount and SelectedCount properties respectively.


How can I programmatically change the current folder for which FileView ActiveX Control displays contents?

You should use the CurrentFolder and CurrentPidl properties.

filevw.CurrentFolder = "c:\"

CurrentFolder only accepts filesystem paths. To set the current folder to a non-filesystem folder like 'Control Panel' use the CurrentPidl property.


How can I reset the current folder to the Desktop?

You should use the ResetToDesktop method.


How can I change the display mode of FileView ActiveX Control to 'Details' view?

You should use the ViewStyle property.

filevw.ViewStyle=Report


How can I refresh the FileView?

You should use the RefreshView method.


How can I show checkboxes for every item?

You should set the ShowCheckBoxes property to True.


How can I programmatically select a specific item in FileView ActiveX Control?

You should use the GetItemFromName method along with the Selected property of ListItem

filevw.GetItemFromName("Win98").Selected = True


How can I determine if an item is a file or a folder?

You should use the Attributes property of ListItem.

if item1.Attributes(Folder) And Folder then msgbox "Folder" else msgbox "File"


How can I determine if an item belongs to the filesystem?

You should use the Attributes property of ListItem.

If item1.Attributes(FileSystem) And FileSystem then msgbox "Folder" else msgbox "File"


How can I determine if an item is a shortcut?

You should use the Attributes property of ListItem.

If item1.Attributes(Link) And Link then msgbox "Folder" else msgbox "File"


How can I determine if an item is readonly or hidden?

You should use the Attributes property of ListItem.

If item1.Attributes(Hidden) And Hidden then msgbox "Folder" else msgbox "File"
if item1.Attributes(ReadOnly) And ReadOnly then msgbox "Folder" else msgbox "File"


How can I determine if an item is a custom item?

You should use the IsCustom property of ListItem.


How can I programmatically check/uncheck a node?

You should use the Checked property of ListItem.


How can I determine the check-state of an item?

You should use the Checked property of ListItem.


How can I determine if a file/folder is selected?

You should use the Selected property of ListItem.


How can I programmatically go to the parent folder of the current folder?

You should use the GoUp method.


How can I show the 'Properties' dialog box for a folder/file?

You should use the ExecuteShellCommand method of ListItem.

item1.ExecuteShellCommand cmdProperties


How can I programmatically open a file and go into a folder in FileView ActiveX Control?

You should use the ExecuteShellCommand method of TreeNode.

item1.ExecuteShellCommand cmdOpen


How can I execute commands like 'Cut', 'Copy', 'Paste', 'Delete', etc. for a folder/file?

You should use the ExecuteShellCommand method of ListItem.

item1.ExecuteShellCommand cmdCut
item1.ExecuteShellCommand cmdCopy

item1.ExecuteShellCommand cmdPaste
item1.ExecuteShellCommand cmdDelete


How can I execute all the above commands for the current folder?

You should use the ExeCmdForFolder method.

filevw.ExeCmdForFolder cmdProperties


How can I execute all above commands for all the selected items in FileView?

You should use the ExeCmdForAllSelected method.

filevw.ExeCmdForAllSelected cmdProperties


How can I get the full path of a folder/file?

You should use the Path property of ListItem.


How can I assign user-defined data for an item?

You should use the UserData property of ListItem to store your data. This property can be set in the OnAfterItemAdd event and freed ( if required ) in the OnBeforeItemDelete event.


How can I use the FileView ActiveX Controls with the FolderView and ShComboBox ActiveX Controls?

All you need to do is write two simple lines of code!!

Fore more information, see Shell MegaPack.
For the latest information, product updates and special offers, please visit our website www.ssware.com

Using the three controls together

FileView can be used with ShComboBox and FolderView to create an entire Windows Explorer with custom functionality in your own application. Shown below is a simple application which uses the three controls together to give Windows Explorer functionality

Linking the three controls involves only two simple lines of code :

Consider a form or a dialog box where you have a FileView Control named fileVw, FolderView Control named fldrVw and a ShComboBox Control named shCmbBox.

Visual Basic

shCmbBox.FolderView = fldrvVw
fldrVw.FileView = fileVw

Visual C++

shCmbBox.SetFolderView((IDispatch*)fldrVw.GetControlUnknown()); fldrVw.SetFileView((IDispatch*)fileVw.GetControlUnknown());

Borland Delphi

shCmbBox.FolderView:=fldrvw.ControlInterface ;
fldrvw.FileView:=filevw.ControlInterface;

Borland C++ Builder

shCmbBox->FolderView = fldrVw->ControlInterface;
fldrVw->FileView = fileVw->ControlInterface;

Microsoft Access

shCmbBox.FolderView = fldrvVw.Object
fldrVw.FileView = fileVw.Object

Using FileView with FolderView only

Using FileView with FolderView requires just one line of code on your part. Just use the lower line of code shown above.

Using FileView with ShComboBox only

Using FileView with ShComboBox requires just one line of code on your part. The code required is given below.

Consider a form or a dialog box where you have a FileView Control named fileVw and a ShComboBox Control named shCmbBox.

Visual Basic

shCmbBox.FileView = fileVw

Visual C++

shCmbBox.SetFileView((IDispatch*)fileVw.GetControlUnknown());

Borland Delphi

shCmbBox.FileView:=filevw.ControlInterface ;

Borland C++ Builder

shCmbBox->FileView = fileVw->ControlInterface;

Microsoft Access

shCmbBox.FolderView = fldrvVw.Object