<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AutoHotkey: определение текущего пути в окне Проводника]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=811&amp;type=atom" />
	<updated>2008-04-09T14:54:29Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=811</id>
		<entry>
			<title type="html"><![CDATA[Re: AutoHotkey: определение текущего пути в окне Проводника]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=10367#p10367" />
			<content type="html"><![CDATA[<p>Для большего удобства копирования пути в буфер вместо MsgBox можно вызвать специальное окно GUI:<br /></p><div class="codebox"><pre><code>F11::
  hWnd := WinExist(&quot;A&quot;) 
  WinGetClass wClass, ahk_id %hWnd% 
  If (wClass != &quot;ExploreWClass&quot; and wClass != &quot;CabinetWClass&quot;) 
     MsgBox Используйте только в окне Проводника! 
  Else
  {  
    ;MsgBox % GetWindowsExplorerPath(hWnd) 
    Res := GetWindowsExplorerPath(hWnd)
    Gui, +AlwaysOnTop
    Gui, Add, Edit, vMainEdit W600
    GuiControl,, MainEdit, %Res%
    Gui, Show, AutoSize Center, Текущий путь
   }
Return

GuiClose:
Gui, Destroy
Return

;=================================================

GetWindowsExplorerPath(_hWnd) 
{ 
   local pid, hMem, pv, pidl, pidl?, explorerPath 

   If (A_OSType = &quot;WIN32_NT&quot;) 
   { 
      pid := DllCall(&quot;GetCurrentProcessId&quot;) 
      SendMessage 0x400 + 12   ; CWM_GETPATH = WM_USER + 12 
            , pid, 0, , ahk_id %_hWnd% 
      hMem := ErrorLevel 
      if (hMem != 0) 
      { 
         pv := DllCall(&quot;Shell32\SHLockShared&quot; 
            , &quot;UInt&quot;, hMem, &quot;UInt&quot;, pid) 
         if (pv != 0) 
         { 
            pidl := DllCall(&quot;Shell32\ILClone&quot;, &quot;UInt&quot;, pv) 
            DllCall(&quot;Shell32\SHUnlockShared&quot;, &quot;UInt&quot;, pv) 
         } 
         DllCall(&quot;Shell32\SHFreeShared&quot; 
            , &quot;UInt&quot;, hMem, &quot;UInt&quot;, pid) 
      } 
   } 
   VarSetCapacity(explorerPath, 512, 0) 
   DllCall(&quot;Shell32\SHGetPathFromIDList&quot; 
      , &quot;UInt&quot;, pidl, &quot;Str&quot;, explorerPath) 
   Return explorerPath 
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Steve Key]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=1104</uri>
			</author>
			<updated>2008-04-09T14:54:29Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=10367#p10367</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AutoHotkey: определение текущего пути в окне Проводника]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=5835#p5835" />
			<content type="html"><![CDATA[<p>Скрипт демонстрирует возможность определения текущего пути в окне Проводника. По нажатию F11 скрипт выводит окно сообщения, в котором указан путь к папке, откытой в текущем окне Проводника. Работает в WinХР, но не работает в Win2000.<br /></p><div class="codebox"><pre><code>F11::
  hWnd := WinExist(&quot;A&quot;) 
  WinGetClass wClass, ahk_id %hWnd% 
  If (wClass != &quot;ExploreWClass&quot; and wClass != &quot;CabinetWClass&quot;) 
     MsgBox Используйте только в окне Проводника! 
  Else 
     MsgBox % GetWindowsExplorerPath(hWnd) 
Return

;=================================================

GetWindowsExplorerPath(_hWnd) 
{ 
   local pid, hMem, pv, pidl, pidl?, explorerPath 

   If (A_OSType = &quot;WIN32_NT&quot;) 
   { 
      pid := DllCall(&quot;GetCurrentProcessId&quot;) 
      SendMessage 0x400 + 12   ; CWM_GETPATH = WM_USER + 12 
            , pid, 0, , ahk_id %_hWnd% 
      hMem := ErrorLevel 
      if (hMem != 0) 
      { 
         pv := DllCall(&quot;Shell32\SHLockShared&quot; 
            , &quot;UInt&quot;, hMem, &quot;UInt&quot;, pid) 
         if (pv != 0) 
         { 
            pidl := DllCall(&quot;Shell32\ILClone&quot;, &quot;UInt&quot;, pv) 
            DllCall(&quot;Shell32\SHUnlockShared&quot;, &quot;UInt&quot;, pv) 
         } 
         DllCall(&quot;Shell32\SHFreeShared&quot; 
            , &quot;UInt&quot;, hMem, &quot;UInt&quot;, pid) 
      } 
   } 
   VarSetCapacity(explorerPath, 512, 0) 
   DllCall(&quot;Shell32\SHGetPathFromIDList&quot; 
      , &quot;UInt&quot;, pidl, &quot;Str&quot;, explorerPath) 
   Return explorerPath 
}</code></pre></div><p>Скрипт опубликовал <strong>YMP</strong>.</p>]]></content>
			<author>
				<name><![CDATA[The gray Cardinal]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=2</uri>
			</author>
			<updated>2007-11-03T09:23:45Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=5835#p5835</id>
		</entry>
</feed>
