Ejemplo n.º 1
0
void CRecBinViewer::ContextMenu (CView* pView, CSelRowArray &ar, CPoint &pt) 
{
	CShellContextMenu scm;
	IShellFolder*psfRecycle = NULL;
	
	IShellFolder* psfDesktop = NULL;
	SHGetDesktopFolder (&psfDesktop);	
	LPITEMIDLIST pidl = NULL;
	SHGetSpecialFolderLocation (NULL, CSIDL_BITBUCKET, &pidl);
	
	psfDesktop->BindToObject(pidl, NULL, IID_IShellFolder, (LPVOID *)&psfRecycle);

	LPITEMIDLIST *pidlArray = (LPITEMIDLIST *) malloc (ar.size () * sizeof (LPITEMIDLIST));

	
	for (unsigned int i = 0 ; i < ar.size () ; i++)				
		pidlArray[i] = m_List[ar[i].m_nRow-1].m_PIDL;		
	
	scm.SetObjects (psfRecycle, pidlArray, ar.size ());
	free (pidlArray);
	psfDesktop->Release ();

	scm.ShowContextMenu (pView, pt);
	if (psfRecycle)
		psfRecycle->Release ();
	
}
Ejemplo n.º 2
0
void CRecBinViewer::Properties (CSelRowArray &ar)
{	
	CShellContextMenu scm;
	IShellFolder*psfRecycle = NULL;
	
	IShellFolder* psfDesktop = NULL;
	SHGetDesktopFolder (&psfDesktop);	
	LPITEMIDLIST pidl = NULL;
	SHGetSpecialFolderLocation (NULL, CSIDL_BITBUCKET, &pidl);
	
	psfDesktop->BindToObject(pidl, NULL, IID_IShellFolder, (LPVOID *)&psfRecycle);

	LPITEMIDLIST *pidlArray = (LPITEMIDLIST *) malloc (ar.size () * sizeof (LPITEMIDLIST));


	for (int i = 0 ; i < static_cast<int>(ar.size()) ; i++)				
		pidlArray[i] = m_List[ar[i].m_nRow-1].m_PIDL;		
	
	scm.SetObjects (psfRecycle, pidlArray, ar.size ());
	free (pidlArray);
	psfDesktop->Release ();

	scm.InvokeCommand (_T("properties"));	
	if (psfRecycle)
		psfRecycle->Release ();
}
Ejemplo n.º 3
0
void showShellContextMenu( const QString& itemPath, QPoint pt, QWidget* pParentWidget, QMenu* pMenu )
{
    CShellContextMenu scm;
    scm.SetObjects(QDir::toNativeSeparators(QDir::cleanPath(itemPath)));
    int id = scm.ShowContextMenu (pParentWidget, pt, pMenu);
    if (id>=1)
       pMenu->actions().value(id-1)->trigger();
}