Click here to Skip to main content
15,916,846 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Question_tfopen Error - file is being used by another process. Pin
Cvaji14-Jul-10 23:20
Cvaji14-Jul-10 23:20 
AnswerRe: _tfopen Error - file is being used by another process. Pin
Richard MacCutchan15-Jul-10 2:12
mveRichard MacCutchan15-Jul-10 2:12 
QuestionEnum Issue Pin
VC_RYK14-Jul-10 23:16
VC_RYK14-Jul-10 23:16 
AnswerRe: Enum Issue Pin
Aescleal14-Jul-10 23:51
Aescleal14-Jul-10 23:51 
GeneralRe: Enum Issue Pin
VC_RYK15-Jul-10 0:54
VC_RYK15-Jul-10 0:54 
QuestionDesktop Context menu "Paste Shortcut" issue, Please help Pin
Rahul Vaishnav14-Jul-10 23:07
Rahul Vaishnav14-Jul-10 23:07 
AnswerRe: Desktop Context menu "Paste Shortcut" issue, Please help Pin
Richard MacCutchan15-Jul-10 2:18
mveRichard MacCutchan15-Jul-10 2:18 
GeneralRe: Desktop Context menu "Paste Shortcut" issue, Please help Pin
Rahul Vaishnav15-Jul-10 2:41
Rahul Vaishnav15-Jul-10 2:41 
Hi Richard,

Thanks for reply...

now I have tried below code...
Below code is not showing crash as I have used "link" as lpVerb.
as you said I have provided all Content of CMINVOKECOMMANDINFO structure. "InvokeCommand" is return S_OK
But still Paste Shortcut is not happening on Desktop.
Frown | :-(


void PasteShortcut()
{
	try
	{
		CoInitialize(NULL);

		IShellFolder* psf;
		HWND hWnd = GetDesktopWindow();
		HRESULT hr;
		if (SUCCEEDED(SHGetDesktopFolder(&psf)))
		{
			IContextMenu* pcm;
			if (SUCCEEDED(psf->CreateViewObject(hWnd,IID_IContextMenu,(void**)&pcm)))
			{
				HMENU hmenu = CreatePopupMenu();
				if (hmenu != NULL) {
					if (SUCCEEDED(pcm->QueryContextMenu(hmenu, 0,
						0 , 0xff,	// since we're invoking by canonical name the menu ID range passed to QueryContextMenu can be arbitrary
						CMF_NORMAL))) {
							CMINVOKECOMMANDINFO  cmi;
						cmi.cbSize = sizeof(CMINVOKECOMMANDINFO);
						cmi.fMask = 0;
						cmi.hwnd = hWnd;
						cmi.lpVerb ="link" ;//(LPCSTR)(INT_PTR)(idCmd - 1);
						cmi.lpParameters = NULL;
						cmi.lpDirectory = NULL;
						cmi.nShow = SW_NORMAL;
						cmi.dwHotKey = 0;
						cmi.hIcon = NULL;
						hr = pcm->InvokeCommand(&cmi);
							
							if (SUCCEEDED(hr)) {
								MessageBox(hWnd, TEXT("Shortcut created"), TEXT("Message"), 0);
							}
					}
					DestroyMenu(hmenu);
				}
				pcm->Release();
			}
			psf->Release();
		}
		CoUninitialize();

	}
	catch(...)
	{
	}

}

GeneralRe: Desktop Context menu "Paste Shortcut" issue, Please help Pin
Richard MacCutchan15-Jul-10 2:55
mveRichard MacCutchan15-Jul-10 2:55 
QuestionVisual C++ equivalent of "TModule" in Borland C++ [modified] Pin
coder21k14-Jul-10 21:48
coder21k14-Jul-10 21:48 
AnswerRe: Visual C++ equivalent of "TModule" in Borland C++ Pin
Cedric Moonen14-Jul-10 21:57
Cedric Moonen14-Jul-10 21:57 
GeneralRe: Visual C++ equivalent of "TModule" in Borland C++ Pin
coder21k14-Jul-10 22:05
coder21k14-Jul-10 22:05 
GeneralRe: Visual C++ equivalent of "TModule" in Borland C++ Pin
Cedric Moonen14-Jul-10 22:13
Cedric Moonen14-Jul-10 22:13 
AnswerRe: Visual C++ equivalent of "TModule" in Borland C++ Pin
Rolf Kristensen15-Jul-10 10:10
Rolf Kristensen15-Jul-10 10:10 
QuestionDrawing 3d Ellipse in MFC Pin
Anu_Bala14-Jul-10 20:09
Anu_Bala14-Jul-10 20:09 
AnswerRe: Drawing 3d Ellipse in MFC Pin
Emilio Garavaglia15-Jul-10 2:06
Emilio Garavaglia15-Jul-10 2:06 
QuestionHow to convert Modal dialog to modeless dialog? Pin
svkotireddy14-Jul-10 19:27
svkotireddy14-Jul-10 19:27 
AnswerRe: How to convert Modal dialog to modeless dialog? Pin
Naveen14-Jul-10 19:30
Naveen14-Jul-10 19:30 
AnswerRe: How to convert Modal dialog to modeless dialog? Pin
Richard MacCutchan14-Jul-10 21:58
mveRichard MacCutchan14-Jul-10 21:58 
Questionhow to convert SDI application to MDI application? Pin
svkotireddy14-Jul-10 19:25
svkotireddy14-Jul-10 19:25 
AnswerRe: how to convert SDI application to MDI application? Pin
Richard MacCutchan14-Jul-10 22:02
mveRichard MacCutchan14-Jul-10 22:02 
AnswerRe: how to convert SDI application to MDI application? Pin
Emilio Garavaglia16-Jul-10 7:19
Emilio Garavaglia16-Jul-10 7:19 
Questionre:Windows VS/C++ and exiting with debuggable/traceable output Pin
Alan Kurlansky14-Jul-10 8:06
Alan Kurlansky14-Jul-10 8:06 
AnswerRe: re:Windows VS/C++ and exiting with debuggable/traceable output Pin
Code-o-mat14-Jul-10 9:26
Code-o-mat14-Jul-10 9:26 
GeneralRe: re:Windows VS/C++ and exiting with debuggable/traceable output Pin
Alan Kurlansky14-Jul-10 10:44
Alan Kurlansky14-Jul-10 10:44 

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.