Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
G

grigri

@grigri
About
Posts
3
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Explorer Selected File - how to retrieve from ToolBar (ToolBand)
    G grigri

    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().

    C / C++ / MFC help tutorial question

  • Explorer Selected File - how to retrieve from ToolBar (ToolBand)
    G grigri

    Use the SHShellFolderView_Message() function to send the SFVM_GETSELECTEDOBJECTS message to the main browser window. link : http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/functions/shshellfolderview_message.asp This supposedly only works for win 2k+. If you need it for windows 98, there is a trick that might help you - if you're in a deskband, you're in an in-process dll, so you can just send LVM_* messages to the inner list view. I have noticed that the lParam member of the LVITEM structure, for explorer list views, is in fact a pointer to the item's PIDL. This isn't documented, it might not work everywhere, but it does work most of the time.

    C / C++ / MFC help tutorial question

  • put icon Context Menu on File selection
    G grigri

    "Static" menu extensions like you are adding through the registry (under the "shell") subkey don't allow icons. At all. If you want to add a menu item with an icon, you need to write a COM shell extension (context menu handler) which implements IContextMenu. Then you can add items to the supplied HMENU. You can use SetMenuItemBitmaps() to add an icon, but it won't be pretty [like the winzip ones]. If you want a really nice full-colour icon you have to implement IContextMenu2 in your shell extension, add an owner-draw item and draw it yourself. Hope this helps grigri

    Visual Basic windows-admin linux tutorial question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups