Support
Joined: 18 Jul 2005 Posts: 731
|
Posted: Sat Jan 03, 2009 10:53 am Post subject: HOWTO: Open a file with its default application when it is double-clicked |
|
|
To execute the default command on a file when it is double-clicked (typically 'open', which opens the file with its associated application), handle the FolderView.NodeDoubleClick event and use the following code in the event handler:
[C++]
Code: | void CFdrViewVCDlg::OnNodeDoubleClickFolderviewctrl1(LPDISPATCH Node)
{
CTreeNode node;
node.AttachDispatch(Node,FALSE);
if (!node.IsFolder()) // Only execute default command for files
{
node.ExecuteShellCommand(cmdDefault);
}
} |
[VB6]
Code: | Private Sub fldrVw_NodeDoubleClick(ByVal Node As FolderViewControl.ITreeNode)
If (Node.IsFolder() = False) Then ' Only execute default command for files
Node.ExecuteShellCommand CmdTypes.cmdDefault
End If
End Sub |
|
|