| 14 | |
| 15 | #if 0 |
| 16 | BOOL HL_Explorer_cxt_menu ( LPCWSTR path, void *parentWindow ) |
| 17 | { |
| 18 | ITEMIDLIST *id = 0; |
| 19 | std::wstring windowsPath = path; |
| 20 | std::replace ( windowsPath.begin(), windowsPath.end(), '/', '\\' ); |
| 21 | HRESULT result = SHParseDisplayName ( windowsPath.c_str(), 0, &id, 0, 0 ); |
| 22 | if ( !SUCCEEDED ( result ) || !id ) { |
| 23 | return false; |
| 24 | } |
| 25 | bool out = true; |
| 26 | IShellFolder *ifolder = 0; |
| 27 | LPCITEMIDLIST idChild = 0; |
| 28 | result = SHBindToParent ( id, IID_IShellFolder, ( void ** ) &ifolder, &idChild ); |
| 29 | if ( !SUCCEEDED ( result ) || !ifolder ) { |
| 30 | out = false; |
| 31 | } |
| 32 | if ( out ) { |
| 33 | IContextMenu2 *imenu = 0; |
| 34 | result = ifolder->GetUIObjectOf ( ( HWND ) parentWindow |
| 35 | , 1 |
| 36 | , ( const ITEMIDLIST ** ) &idChild |
| 37 | , IID_IContextMenu |
| 38 | , 0 |
| 39 | , ( void ** ) &imenu ); |
| 40 | if ( !SUCCEEDED ( result ) || !ifolder ) { |
| 41 | out = false; |
| 42 | } |
| 43 | if ( out ) { |
| 44 | HMENU hMenu = CreatePopupMenu(); |
| 45 | if ( !hMenu ) { |
| 46 | out = false; |
| 47 | } |
| 48 | if ( out && SUCCEEDED ( imenu->QueryContextMenu ( hMenu, 0, 1, 0x7FFF, _hl_ctx_menu_type ) ) ) { |
| 49 | POINT pt ; |
| 50 | GetCursorPos ( &pt ); |
| 51 | int iCmd = TrackPopupMenuEx ( hMenu, TPM_RETURNCMD, pt.x, pt.y, ( HWND ) parentWindow, NULL ); |
| 52 | if ( iCmd > 0 ) { |
| 53 | CMINVOKECOMMANDINFOEX info = { 0 }; |
| 54 | info.cbSize = sizeof ( info ); |
| 55 | info.fMask = CMIC_MASK_UNICODE; |
| 56 | info.hwnd = ( HWND ) parentWindow; |
| 57 | info.lpVerb = MAKEINTRESOURCEA ( iCmd - 1 ); |
| 58 | info.lpVerbW = MAKEINTRESOURCEW ( iCmd - 1 ); |
| 59 | info.nShow = SW_SHOWNORMAL; |
| 60 | imenu->InvokeCommand ( ( LPCMINVOKECOMMANDINFO ) &info ); |
| 61 | } |
| 62 | } |
| 63 | if ( hMenu ) { |
| 64 | DestroyMenu ( hMenu ); |
| 65 | } |
| 66 | } |
| 67 | if ( imenu ) { |
| 68 | imenu->Release(); |
| 69 | } |
| 70 | } |
| 71 | if ( ifolder ) { |
| 72 | ifolder->Release(); |
| 73 | } |
no test coverage detected