Sky Software Homepage LogicNP Software Knowledge Base And FAQ

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

HOWTO: Retrieve selected items in Windows Explorer or a File Open/Save dialog

 
Subscribe to the RSS feed for this forum  Forum Index -> EZNamespaceExtensionsMFC
View previous topic :: View next topic  
Author Message
Support



Joined: 18 Jul 2005
Posts: 731

Posted: Tue Aug 26, 2008 8:33 am    Post subject: HOWTO: Retrieve selected items in Windows Explorer or a File Open/Save dialog

Use the GetSelectedItems() function in the OnSelectionChanged() function to retrieve the list of selected items in Windows Explorer or a File Open/Save dialog.

This can be used in combination with the OnCommonDialogOKButtonClicked() function to determine the item(s) selected in the File Open/Save dialog when the 'OK' button is clicked (or when item is double-clicked or when item is selected and 'Enter' is pressed) :


//.h file
class MyNSEFolder: public CNSEFolder
{
public:

...
...
CPtrList* selectedItems;
virtual void OnSelectionChanged();
virtual void OnCommonDialogOKButtonClicked(CCommonDialogOKButtonClickedEventArgs& e);
...
...

};

////////////////////////////////////////////////////////////////////

//.cpp file
...
...
void MyNSEFolder::OnSelectionChanged()
{
selectedItems = this->GetSelectedItems();
}

void MyNSEFolder::OnCommonDialogOKButtonClicked(CCommonDialogOKButtonClickedEventArgs& e)
{
// 'selectedItems' now contains user-selected item(s)
POSITION p = selectedItems->GetHeadPosition();
CNSEItem* item;
while(p!= NULL)
{
item =(CNSEItem*) selectedItems->GetNext(p);
CString str;
item->GetDisplayName(str);
TRACE(str);
}
}
Back to top
Display posts from previous:   
Forum Index -> EZNamespaceExtensionsMFC All times are GMT
Page 1 of 1

 
Jump to:  


Powered by phpBB © 2001, 2005 phpBB Group