<?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=6447</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=6447&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: ИзбежатьПоявленияУдалённогоТрей-значкаПослеПерезапускаПроводника».]]></description>
		<lastBuildDate>Wed, 16 Nov 2011 19:20:35 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: ИзбежатьПоявленияУдалённогоТрей-значкаПослеПерезапускаПроводника]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=53577#p53577</link>
			<description><![CDATA[<p>Моя забота о краткости подвела: избежать предполагалось возникновения вновь, в конечном итоге, значка программы <a href="http://www.filehippo.com/download_google_desktop/">Google Desktop Search</a>.<br /><strong>Alectric</strong>, твой пример хорош, но, кажется, в крайнем случае.</p>]]></description>
			<author><![CDATA[null@example.com (DD)]]></author>
			<pubDate>Wed, 16 Nov 2011 19:20:35 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=53577#p53577</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: ИзбежатьПоявленияУдалённогоТрей-значкаПослеПерезапускаПроводника]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=53567#p53567</link>
			<description><![CDATA[<div class="codebox"><pre><code>^1::Menu, Tray, NoIcon
^2::Menu, Tray, Icon</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Wed, 16 Nov 2011 14:43:58 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=53567#p53567</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: ИзбежатьПоявленияУдалённогоТрей-значкаПослеПерезапускаПроводника]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=53566#p53566</link>
			<description><![CDATA[<p>Попробуй так:<br /></p><div class="codebox"><pre><code>^1::
  RegExMatch(TrayIcons(&quot;AutoHotkey.exe&quot;), &quot;uID: (\d+).+?hWnd: (\d+)&quot;, id) 
  settimer,removetray,100
  Return
 
^2::
  Process, Close, explorer.exe
  Return


removetray:
RemoveTrayIcon(id2, id1)
return

...</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Alectric)]]></author>
			<pubDate>Wed, 16 Nov 2011 13:52:06 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=53566#p53566</guid>
		</item>
		<item>
			<title><![CDATA[AHK: ИзбежатьПоявленияУдалённогоТрей-значкаПослеПерезапускаПроводника]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=53564#p53564</link>
			<description><![CDATA[<p><strong>AHK</strong>: Избежать повторного появления удалённого трей-значка после перезапуска Проводника</p><p>По нажатии Ctrl+1 следующий <a href="http://www.autohotkey.com/forum/topic17314.html+icon+tray">код</a> удалит свой же значок в трее. Но Ctrl+2, перезапустив Проводник (для примера) — вернёт значок.<br />Побороть можно?</p><div class="codebox"><pre><code>
;#NoTrayIcon
#SingleInstance force
DetectHiddenWindows,On  ;!!

^1::
  RegExMatch(TrayIcons(&quot;AutoHotkey.exe&quot;), &quot;uID: (\d+).+?hWnd: (\d+)&quot;, id) 
  RemoveTrayIcon(id2, id1)
  Return

^2::
  Process, Close, explorer.exe
  Return


TrayIcons(sExeName = &quot;&quot;)
{
	WinGet,	pidTaskbar, PID, ahk_class Shell_TrayWnd
	hProc:=	DllCall(&quot;OpenProcess&quot;, &quot;Uint&quot;, 0x38, &quot;int&quot;, 0, &quot;Uint&quot;, pidTaskbar)
	pProc:=	DllCall(&quot;VirtualAllocEx&quot;, &quot;Uint&quot;, hProc, &quot;Uint&quot;, 0, &quot;Uint&quot;, 32, &quot;Uint&quot;, 0x1000, &quot;Uint&quot;, 0x4)
	idxTB:=	GetTrayBar()
		SendMessage, 0x418, 0, 0, ToolbarWindow32%idxTB%, ahk_class Shell_TrayWnd   ; TB_BUTTONCOUNT
	Loop,	%ErrorLevel%
	{
		SendMessage, 0x417, A_Index-1, pProc, ToolbarWindow32%idxTB%, ahk_class Shell_TrayWnd   ; TB_GETBUTTON
		VarSetCapacity(btn,32,0), VarSetCapacity(nfo,32,0)
		DllCall(&quot;ReadProcessMemory&quot;, &quot;Uint&quot;, hProc, &quot;Uint&quot;, pProc, &quot;Uint&quot;, &amp;btn, &quot;Uint&quot;, 32, &quot;Uint&quot;, 0)
			iBitmap	:= NumGet(btn, 0)
			idn	:= NumGet(btn, 4)
			Statyle := NumGet(btn, 8)
		If	dwData	:= NumGet(btn,12)
			iString	:= NumGet(btn,16)
		Else	dwData	:= NumGet(btn,16,&quot;int64&quot;), iString:=NumGet(btn,24,&quot;int64&quot;)
		DllCall(&quot;ReadProcessMemory&quot;, &quot;Uint&quot;, hProc, &quot;Uint&quot;, dwData, &quot;Uint&quot;, &amp;nfo, &quot;Uint&quot;, 32, &quot;Uint&quot;, 0)
		If	NumGet(btn,12)
			hWnd	:= NumGet(nfo, 0)
		,	uID	:= NumGet(nfo, 4)
		,	nMsg	:= NumGet(nfo, 8)
		,	hIcon	:= NumGet(nfo,20)
		Else	hWnd	:= NumGet(nfo, 0,&quot;int64&quot;), uID:=NumGet(nfo, 8), nMsg:=NumGet(nfo,12)
		WinGet, pid, PID,              ahk_id %hWnd%
		WinGet, sProcess, ProcessName, ahk_id %hWnd%
		WinGetClass, sClass,           ahk_id %hWnd%
		If !sExeName || (sExeName = sProcess) || (sExeName = pid)
			VarSetCapacity(sTooltip,128), VarSetCapacity(wTooltip,128*2)
		,	DllCall(&quot;ReadProcessMemory&quot;, &quot;Uint&quot;, hProc, &quot;Uint&quot;, iString, &quot;Uint&quot;, &amp;wTooltip, &quot;Uint&quot;, 128*2, &quot;Uint&quot;, 0)
		,	DllCall(&quot;WideCharToMultiByte&quot;, &quot;Uint&quot;, 0, &quot;Uint&quot;, 0, &quot;str&quot;, wTooltip, &quot;int&quot;, -1, &quot;str&quot;, sTooltip, &quot;int&quot;, 128, &quot;Uint&quot;, 0, &quot;Uint&quot;, 0)
		,	sTrayIcons .= &quot;idx: &quot; . A_Index-1 . &quot; | idn: &quot; . idn . &quot; | Pid: &quot; . pid . &quot; | uID: &quot; . uID . &quot; | MessageID: &quot; . nMsg . &quot; | hWnd: &quot; . hWnd . &quot; | Class: &quot; . sClass . &quot; | Process: &quot; . sProcess . &quot;`n&quot; . &quot;   | Tooltip: &quot; . sTooltip . &quot;`n&quot;
	}
	DllCall(&quot;VirtualFreeEx&quot;, &quot;Uint&quot;, hProc, &quot;Uint&quot;, pProc, &quot;Uint&quot;, 0, &quot;Uint&quot;, 0x8000)
	DllCall(&quot;CloseHandle&quot;, &quot;Uint&quot;, hProc)
	Return	sTrayIcons
}

RemoveTrayIcon(hWnd, uID, nMsg = 0, hIcon = 0, nRemove = 2)
{
	NumPut(VarSetCapacity(ni,444,0), ni)
	NumPut(hWnd , ni, 4)
	NumPut(uID  , ni, 8)
	NumPut(1|2|4, ni,12)
	NumPut(nMsg , ni,16)
	NumPut(hIcon, ni,20)
	Return	DllCall(&quot;shell32\Shell_NotifyIconA&quot;, &quot;Uint&quot;, nRemove, &quot;Uint&quot;, &amp;ni)
}

GetTrayBar()
{
	ControlGet, hParent, hWnd,, TrayNotifyWnd1  , ahk_class Shell_TrayWnd
	ControlGet, hChild , hWnd,, ToolbarWindow321, ahk_id %hParent%
	Loop
	{
		ControlGet, hWnd, hWnd,, ToolbarWindow32%A_Index%, ahk_class Shell_TrayWnd
		If  Not	hWnd
			Break
		Else If	hWnd = %hChild%
		{
			idxTB := A_Index
			Break
		}
	}
	Return	idxTB
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (DD)]]></author>
			<pubDate>Wed, 16 Nov 2011 11:34:52 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=53564#p53564</guid>
		</item>
	</channel>
</rss>
