Skip to main content

Posts

Showing posts from November, 2011

Explorer Context Menu in your App

As I am currently working on C++ project, I learn lots of new things daily. In our project we needed to provide Explorer's Context Menu for our custom built explorer. This requires COM, many C++ programmers know that COM is one of the tough topics from C++ Windows Development. Anyways, this post describes about how to use Explorer's Context Menu in C++ application. This requires understanding of COM, COM related objects which you can find here . Following is the code snippet which shows how this can be done. IShellFolder *psfDesktop; SHGetDesktopFolder(&psfDesktop); // Retrieve Desktop's Shell Folder handle if(psfDesktop) {  LPITEMIDLIST pidl;  BSTR strMyFolderPath = ::SysAllocString(L"C:\\myfolder");  psfDesktop->ParseDisplayName(hWnd, 0, strMyFolderPath, NULL, &pidl, NULL);  ::SysFreeString(strMyFolderPath);