<?xml version='1.0' encoding="utf-8"?>
      <rss version='2.0'>
      <channel>
      <title>Форум на Исходниках.RU</title>
      <link>https://forum.sources.ru</link>
      <description>Форум на Исходниках.RU</description>
      <generator>Форум на Исходниках.RU</generator>
  	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=366720&amp;view=findpost&amp;p=3228307</guid>
        <pubDate>Tue, 30 Oct 2012 18:36:59 +0000</pubDate>
        <title>Контестное меню для нескольких файлов/папок</title>
        <link>https://forum.sources.ru/index.php?showtopic=366720&amp;view=findpost&amp;p=3228307</link>
        <description><![CDATA[Lumen: <a class='tag-url' href='http://forum.sources.ru/index.php?showtopic=331886&view=findpost&p=2965844' target='_blank'>Возможно ли Popup-меню инициализировать стандартным меню виндовс? (сообщение #2965844)</a> здесь я когда-то тоже спрашивал. Потом тоже допёр. Если надо - могу полностью код приложить.]]></description>
        <author>Lumen</author>
        <category>Delphi: Система, Windows API</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=366720&amp;view=findpost&amp;p=3227143</guid>
        <pubDate>Sun, 28 Oct 2012 22:27:13 +0000</pubDate>
        <title>Контестное меню для нескольких файлов/папок</title>
        <link>https://forum.sources.ru/index.php?showtopic=366720&amp;view=findpost&amp;p=3227143</link>
        <description><![CDATA[VahaC: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=366720&view=findpost&p=3227063'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>Rouse_ &#064; <time class="tag-quote__quoted-time" datetime="2012-10-28T20:12:45+00:00">28.10.12, 20:12</time></span><div class='quote '>Оно?<br>
Контекстное меню для файла</div></div><br>
немного не оно<br>
<br>
там для одного файла, а у меня для нескольких<br>
<br>
<br>
<div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=366720&view=findpost&p=3227005'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>antonn &#064; <time class="tag-quote__quoted-time" datetime="2012-10-28T19:13:20+00:00">28.10.12, 19:13</time></span><div class='quote '>это твой код?</div></div><br>
 взял код для одного айтема и перекрутил чтобы работало и для одного и для нескольких]]></description>
        <author>VahaC</author>
        <category>Delphi: Система, Windows API</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=366720&amp;view=findpost&amp;p=3227063</guid>
        <pubDate>Sun, 28 Oct 2012 20:12:45 +0000</pubDate>
        <title>Контестное меню для нескольких файлов/папок</title>
        <link>https://forum.sources.ru/index.php?showtopic=366720&amp;view=findpost&amp;p=3227063</link>
        <description><![CDATA[Rouse_: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=366720&view=findpost&p=3226989'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>VahaC &#064; <time class="tag-quote__quoted-time" datetime="2012-10-28T17:38:10+00:00">28.10.12, 17:38</time></span><div class='quote '>Кстати добавьте код в FAQ, а то в нете готового кода нету</div></div><br>
Оно?<br>
<a class='tag-url' href='http://forum.sources.ru/index.php?showtopic=112368' target='_blank'>Контекстное меню для файла</a>]]></description>
        <author>Rouse_</author>
        <category>Delphi: Система, Windows API</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=366720&amp;view=findpost&amp;p=3227005</guid>
        <pubDate>Sun, 28 Oct 2012 19:13:20 +0000</pubDate>
        <title>Контестное меню для нескольких файлов/папок</title>
        <link>https://forum.sources.ru/index.php?showtopic=366720&amp;view=findpost&amp;p=3227005</link>
        <description><![CDATA[antonn: <div class='tag-quote'><span class='tag-quote-prefix'>Цитата</span> <div class='quote '>Кстати добавьте код в FAQ, а то в нете готового кода нету (а может просто плохо искал)</div></div><br>
это твой код? добавлю у себя]]></description>
        <author>antonn</author>
        <category>Delphi: Система, Windows API</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=366720&amp;view=findpost&amp;p=3226989</guid>
        <pubDate>Sun, 28 Oct 2012 17:38:10 +0000</pubDate>
        <title>Контестное меню для нескольких файлов/папок</title>
        <link>https://forum.sources.ru/index.php?showtopic=366720&amp;view=findpost&amp;p=3226989</link>
        <description><![CDATA[VahaC: Нужно из своей проги вызвать контекстное меню для нескольких файлов/папок <br>
делаю это так<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">procedure ShowSysPopup(aFileLst: TStringList; P: TPoint; HND: HWND);</div><div class="code_line">var</div><div class="code_line">&nbsp;&nbsp;Root: IShellFolder;</div><div class="code_line">&nbsp;&nbsp;ShellParentFolder: IShellFolder;</div><div class="code_line">&nbsp;&nbsp;chEaten,dwAttributes: ULONG;</div><div class="code_line">&nbsp;&nbsp;ParentFolderPIDL: PItemIDList;</div><div class="code_line">&nbsp;&nbsp;FilesPIDL: PArrayOfPItemIDList;</div><div class="code_line">&nbsp;&nbsp;CM: IContextMenu;</div><div class="code_line">&nbsp;&nbsp;Menu: HMenu;</div><div class="code_line">&nbsp;&nbsp;Command: LongBool;</div><div class="code_line">&nbsp;&nbsp;ICM2: IContextMenu2;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp;ICI: TCMInvokeCommandInfo;</div><div class="code_line">&nbsp;&nbsp;ICmd: integer;</div><div class="code_line">&nbsp;&nbsp;ZVerb: array[0..255] of AnsiChar;</div><div class="code_line">&nbsp;&nbsp;Verb: string;</div><div class="code_line">&nbsp;&nbsp;Handled: boolean;</div><div class="code_line">&nbsp;&nbsp;SCV: IShellCommandVerb;</div><div class="code_line">&nbsp;&nbsp;HR: HResult;</div><div class="code_line">&nbsp;&nbsp;I: Integer;</div><div class="code_line">&nbsp;&nbsp;Malloc: IMalloc;</div><div class="code_line">begin</div><div class="code_line">&nbsp;&nbsp;OleCheck(SHGetMalloc(Malloc));</div><div class="code_line">&nbsp;&nbsp;OleCheck(SHGetDesktopFolder(Root));//Get the Desktop IShellFolder interface</div><div class="code_line">&nbsp;&nbsp;OleCheck(Root.ParseDisplayName(HND, nil, PWideChar(WideString(ExtractFilePath(aFileLst[0]))),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;chEaten, ParentFolderPIDL, dwAttributes)); // Get the PItemIDList of the parent folder</div><div class="code_line">&nbsp;&nbsp;OleCheck(Root.BindToObject(ParentFolderPIDL, nil, IShellFolder,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ShellParentFolder)); // Get the IShellFolder Interface &nbsp;of the Parent Folder</div><div class="code_line">&nbsp;&nbsp;FilesPIDL := AllocMem(SizeOf(PItemIDList) * aFileLst.Count);</div><div class="code_line">&nbsp;&nbsp;try</div><div class="code_line">&nbsp;&nbsp; &nbsp;for I := 0 to aFileLst.Count - 1 do</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;OleCheck(ShellParentFolder.ParseDisplayName(HND, nil, PWideChar(WideString(ExtractFileName(aFileLst[I]))),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;chEaten, FilesPIDL[I], dwAttributes)); // Get the relative &nbsp;PItemIDList of the File</div><div class="code_line">&nbsp;&nbsp; &nbsp;ShellParentFolder.GetUIObjectOf(HND, aFileLst.Count, FilesPIDL^[0], IID_IContextMenu, nil, CM); // get the IContextMenu Interace for the file</div><div class="code_line">&nbsp;&nbsp;finally</div><div class="code_line">&nbsp;&nbsp; &nbsp;for i := 0 to aFileLst.Count - 1 do begin</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;if FilesPIDL^[i] &#60;&#62; nil then Malloc.Free(FilesPIDL^[i]);</div><div class="code_line">&nbsp;&nbsp; &nbsp;end;</div><div class="code_line">&nbsp;&nbsp; &nbsp; FreeMem(FilesPIDL);</div><div class="code_line">&nbsp;&nbsp;end;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp;if CM = nil then Exit;</div><div class="code_line">&nbsp;&nbsp;Menu := CreatePopupMenu;</div><div class="code_line">&nbsp;&nbsp;try</div><div class="code_line">&nbsp;&nbsp; &nbsp;CM.QueryContextMenu(Menu, 0, 1, FFF, CMF_EXPLORE or CMF_CANRENAME);</div><div class="code_line">&nbsp;&nbsp; &nbsp;CM.QueryInterface(IID_IContextMenu2, ICM2); //To handle submenus.</div><div class="code_line">&nbsp;&nbsp; &nbsp;try</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;Command := TrackPopupMenu(Menu, TPM_LEFTALIGN or TPM_LEFTBUTTON or TPM_RIGHTBUTTON or TPM_RETURNCMD, p.X, p.Y, 0, HND, nil);</div><div class="code_line">&nbsp;&nbsp; &nbsp;finally</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;ICM2 := nil;</div><div class="code_line">&nbsp;&nbsp; &nbsp;end;</div><div class="code_line">&nbsp;&nbsp; &nbsp;if Command then begin</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;ICmd := LongInt(Command) - 1;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;HR := CM.GetCommandString(ICmd, GCS_VERBA, nil, ZVerb, SizeOf(ZVerb));</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;Verb := StrPas(ZVerb);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;Handled := False;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;if Supports(nil, IShellCommandVerb, SCV) then begin</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;HR := 0;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;SCV.ExecuteCommand(Verb, Handled);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;end;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;if not Handled then begin</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;FillChar(ICI, SizeOf(ICI), #0);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;with ICI do begin</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cbSize := SizeOf(ICI);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;hWND := 0;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;lpVerb := MakeIntResourceA(ICmd);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;nShow := SW_SHOWNORMAL;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;end;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;HR := CM.InvokeCommand(ICI);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;end;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;if Assigned(SCV) then</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;SCV.CommandCompleted(Verb, HR = S_OK);</div><div class="code_line">&nbsp;&nbsp; &nbsp;end;</div><div class="code_line">&nbsp;&nbsp;finally</div><div class="code_line">&nbsp;&nbsp; &nbsp; DestroyMenu(Menu)</div><div class="code_line">&nbsp;&nbsp;end;</div><div class="code_line">end;</div></ol></div></div></div></div><script>preloadCodeButtons('1');</script><br>
но меню появляется так как будто выбран только один, а не несколько файлов.<br>
подскажите плз, где ошибка в моем коде? <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2012-10-28T18:04:05+00:00">28.10.12, 18:04</time></span></span><br>
сори что потревожил  ;)  <br>
кажись работает как надо<br>
просто была ошибка в формировке списка файлов<br>
<br>
ПС<br>
Кстати добавьте код в  FAQ, а то в нете готового кода нету (а может просто плохо искал)]]></description>
        <author>VahaC</author>
        <category>Delphi: Система, Windows API</category>
      </item>
	
      </channel>
      </rss>
	