<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: Закрепить приложение на панели задач с недокументированным апи]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=17968</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=17968&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: Закрепить приложение на панели задач с недокументированным апи».]]></description>
		<lastBuildDate>Sun, 08 Oct 2023 12:04:48 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[AHK: Закрепить приложение на панели задач с недокументированным апи]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=159313#p159313</link>
			<description><![CDATA[<p><a href="https://geelaw.blog/entries/msedge-pins">https://geelaw.blog/entries/msedge-pins</a><br /><a href="https://github.com/vhanla/W1nDro1d/blob/main/TaskbarPinner.pas">https://github.com/vhanla/W1nDro1d/blob … Pinner.pas</a><br /></p><div class="codebox"><pre><code>msgbox % GetAllPinned()
pin(&quot;C:\Windows\System32\Notepad.exe&quot;)
msgbox pinned
unpin(&quot;C:\Windows\System32\Notepad.exe&quot;)
msgbox unpinned

pin(app)   ; https://geelaw.blog/entries/msedge-pins https://github.com/vhanla/W1nDro1d/blob/main/TaskbarPinner.pas
{
   static oIPinnedList3 := TaskbandPin_Init()
   static FOLDERID_System := SHGetKnownFolderPath(&quot;{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}&quot;)
   if A_Is64bitOS and (A_PtrSize = 4) and InStr(app, FOLDERID_System)
   {
      msgbox For applications in %FOLDERID_System% need to run script with ahk64.
      exitapp
   }
   pidl := DllCall(&quot;Shell32.dll\ILCreateFromPathW&quot;, &quot;wstr&quot;, app, &quot;ptr&quot;)
   if DllCall(NumGet(NumGet(oIPinnedList3+0)+9*A_PtrSize), &quot;ptr&quot;, oIPinnedList3, &quot;ptr&quot;, pidl)  ; IsPinned
      DllCall(NumGet(NumGet(oIPinnedList3+0)+16*A_PtrSize), &quot;ptr&quot;, oIPinnedList3, &quot;ptr&quot;, 0, &quot;ptr&quot;, pidl, &quot;int&quot;, PLMC_EXPLORER := 4)   ; modify
   DllCall(&quot;Shell32.dll\ILFree&quot;, &quot;ptr&quot;, pidl)
}

unpin(app)
{
   static oIPinnedList3 := TaskbandPin_Init()
   static FOLDERID_System := SHGetKnownFolderPath(&quot;{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}&quot;)
   if A_Is64bitOS and (A_PtrSize = 4) and InStr(app, FOLDERID_System)
   {
      msgbox For applications in %FOLDERID_System% need to run script with ahk64.
      exitapp
   }
   pidl := DllCall(&quot;Shell32.dll\ILCreateFromPathW&quot;, &quot;wstr&quot;, app, &quot;ptr&quot;)
   if !DllCall(NumGet(NumGet(oIPinnedList3+0)+9*A_PtrSize), &quot;ptr&quot;, oIPinnedList3, &quot;ptr&quot;, pidl)  ; IsPinned
      DllCall(NumGet(NumGet(oIPinnedList3+0)+16*A_PtrSize), &quot;ptr&quot;, oIPinnedList3, &quot;ptr&quot;, pidl, &quot;ptr&quot;, 0, &quot;int&quot;, PLMC_EXPLORER := 4)   ; modify
   DllCall(&quot;Shell32.dll\ILFree&quot;, &quot;ptr&quot;, pidl)
}

GetAllPinned()
{
   static oIPinnedList3 := TaskbandPin_Init()
   DllCall(NumGet(NumGet(oIPinnedList3+0)+3*A_PtrSize), &quot;ptr&quot;, oIPinnedList3, &quot;ptr*&quot;, IEnumFullIDList)  ; EnumObjects
   DllCall(NumGet(NumGet(IEnumFullIDList+0)+5*A_PtrSize), &quot;ptr&quot;, IEnumFullIDList)   ; reset
   loop
   {
      if DllCall(NumGet(NumGet(IEnumFullIDList+0)+3*A_PtrSize), &quot;ptr&quot;, IEnumFullIDList, &quot;uint&quot;, 1, &quot;ptr*&quot;, pidl, &quot;uint*&quot;, null)   ; next
         break
      VarSetCapacity(FilePath, 512, 0)
      DllCall(&quot;Shell32.dll\SHGetPathFromIDListW&quot;, &quot;ptr&quot;, pidl, &quot;str&quot;, FilePath)
      FilePaths .= FilePath &quot;`n&quot;
      DllCall(&quot;Ole32.dll\CoTaskMemFree&quot;, &quot;ptr&quot;, pidl)
   }
   return FilePaths
}

TaskbandPin_Init()
{
   static oIPinnedList3
   if !oIPinnedList3
      oIPinnedList3 := ComObjCreate(CLSID_TaskbandPin := &quot;{90AA3A4E-1CBA-4233-B8BB-535773D48449}&quot;, IPinnedList3 := &quot;{0DD79AE2-D156-45D4-9EEB-3B549769E940}&quot;)
   return oIPinnedList3
}

SHGetKnownFolderPath(FOLDERID, KF_FLAG:=0) {                  ;   By SKAN on D356 @ tiny.cc/t-75602 
Local CLSID, pPath:=&quot;&quot;                                        ; Thanks teadrinker @ tiny.cc/p286094
Return Format(&quot;{4:}&quot;, VarSetCapacity(CLSID, 16, 0)
     , DllCall(&quot;ole32\CLSIDFromString&quot;, &quot;Str&quot;,FOLDERID, &quot;Ptr&quot;,&amp;CLSID)
     , DllCall(&quot;shell32\SHGetKnownFolderPath&quot;, &quot;Ptr&quot;,&amp;CLSID, &quot;UInt&quot;,KF_FLAG, &quot;Ptr&quot;,0, &quot;PtrP&quot;,pPath)
     , StrGet(pPath, &quot;utf-16&quot;)
     , DllCall(&quot;ole32\CoTaskMemFree&quot;, &quot;Ptr&quot;,pPath))
}</code></pre></div><p><a href="http://forum.script-coding.com/viewtopic.php?pid=159314">Тема для обсуждения</a></p>]]></description>
			<author><![CDATA[null@example.com (Malcev)]]></author>
			<pubDate>Sun, 08 Oct 2023 12:04:48 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=159313#p159313</guid>
		</item>
	</channel>
</rss>
