Click here to Skip to main content
15,900,110 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Script Hosting advice Pin
Michael P Butler19-Jun-04 2:38
Michael P Butler19-Jun-04 2:38 
GeneralVC++ 6.0 developer neaded Pin
Irek Zielinski18-Jun-04 8:54
Irek Zielinski18-Jun-04 8:54 
GeneralRe: VC++ 6.0 developer neaded Pin
gamitech18-Jun-04 9:08
gamitech18-Jun-04 9:08 
GeneralRe: VC++ 6.0 developer neaded Pin
Irek Zielinski18-Jun-04 9:11
Irek Zielinski18-Jun-04 9:11 
GeneralExplorer Selected File - how to retrieve from ToolBar (ToolBand) Pin
sas222218-Jun-04 8:53
sas222218-Jun-04 8:53 
GeneralRe: Explorer Selected File - how to retrieve from ToolBar (ToolBand) Pin
grigri21-Jun-04 2:43
grigri21-Jun-04 2:43 
GeneralRe: Explorer Selected File - how to retrieve from ToolBar (ToolBand) Pin
sas222221-Jun-04 5:26
sas222221-Jun-04 5:26 
GeneralRe: Explorer Selected File - how to retrieve from ToolBar (ToolBand) Pin
grigri22-Jun-04 9:47
grigri22-Jun-04 9:47 
hmm... I tried it and it crashed too. Never mind, I found a better way. This example lists all the selected items and displays them in a message box:
HWND hWndBrowser = ::GetAncestor(m_hWnd, GA_ROOT);
char szBuf[4096];
IShellBrowser *pISB = (IShellBrowser*)SendMessage(hWndBrowser, WM_USER+7, 0, NULL);
if (pISB)
{
	IShellView *pISV = NULL;
	if (SUCCEEDED(pISB->QueryActiveShellView(&pISV)))
	{
		IDataObject *pIDO;
		HDROP hDrop;
		UINT      uNumFiles;
		char szFile[MAX_PATH];
		pISV->GetItemObject(SVGIO_SELECTION, IID_IDataObject, (void**)&pIDO);
		FORMATETC etc = { CF_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
		STGMEDIUM stg = { TYMED_HGLOBAL };

		if ( FAILED( pIDO->GetData ( &etc, &stg )))
				return E_INVALIDARG;
		hDrop = (HDROP) GlobalLock ( stg.hGlobal );
		if ( !hDrop )
		{
			ReleaseStgMedium ( &stg );
			return E_INVALIDARG;
		}
		uNumFiles = DragQueryFile ( hDrop, 0xFFFFFFFF, NULL, 0 );
		szBuf[0] = '\0';
		for (UINT uFile = 0; uFile < uNumFiles; uFile++)
		{
			if (!DragQueryFile( hDrop, uFile, szFile, MAX_PATH ))
				continue;
			wsprintf(szBuf, "%s\n%s", szBuf, szFile);
		}

		MessageBox(lpcmi->hwnd, szBuf, "Selected Files", MB_OK);


		GlobalUnlock ( stg.hGlobal );
		ReleaseStgMedium ( &stg );

		pIDO->Release();
		pISV->Release();
	}
}

This is called from within a band object's IContextMenu::InvokeCommand() method, m_hWnd is the band object's window handle. Since you already have the handle to the main explorer window, you won't have to call GetAncestor().
GeneralRe: Explorer Selected File - how to retrieve from ToolBar (ToolBand) Pin
sas222223-Jun-04 3:33
sas222223-Jun-04 3:33 
GeneralVC++ ActiveX Pin
Wender Oliveira18-Jun-04 7:38
Wender Oliveira18-Jun-04 7:38 
GeneralRe: VC++ ActiveX Pin
TimWallace18-Jun-04 9:14
TimWallace18-Jun-04 9:14 
GeneralRe: VC++ ActiveX Pin
Wender Oliveira18-Jun-04 9:19
Wender Oliveira18-Jun-04 9:19 
GeneralRe: VC++ ActiveX Pin
Nick Parker18-Jun-04 11:56
protectorNick Parker18-Jun-04 11:56 
GeneralDirectx and non-rectangular dialogs Pin
Xavi Temporal18-Jun-04 7:09
Xavi Temporal18-Jun-04 7:09 
Generalstd::string strange error Pin
Scozturk18-Jun-04 6:49
professionalScozturk18-Jun-04 6:49 
GeneralRe: std::string strange error Pin
Scozturk18-Jun-04 6:56
professionalScozturk18-Jun-04 6:56 
GeneralRe: std::string strange error Pin
James R. Twine18-Jun-04 11:06
James R. Twine18-Jun-04 11:06 
GeneralSetting the print title column Pin
mcgahanfl18-Jun-04 5:43
mcgahanfl18-Jun-04 5:43 
GeneralRe: Setting the print title column Pin
Johan Rosengren18-Jun-04 5:53
Johan Rosengren18-Jun-04 5:53 
Generalstd::string and reserve question ... Pin
Maximilien18-Jun-04 5:24
Maximilien18-Jun-04 5:24 
GeneralRe: std::string and reserve question ... Pin
palbano18-Jun-04 6:00
palbano18-Jun-04 6:00 
GeneralRe: std::string and reserve question ... Pin
Maximilien18-Jun-04 8:24
Maximilien18-Jun-04 8:24 
GeneralRe: std::string and reserve question ... Pin
James R. Twine18-Jun-04 11:20
James R. Twine18-Jun-04 11:20 
GeneralExperts help with Threads with Notifications Pin
18-Jun-04 4:50
suss18-Jun-04 4:50 
GeneralRe: Experts help with Threads with Notifications Pin
Blake Miller18-Jun-04 5:47
Blake Miller18-Jun-04 5:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.