<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Cкрыть/показать строки контекстного меню "windows"]]></title>
	<link rel="self" href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=11392&amp;type=atom" />
	<updated>2016-03-15T14:12:17Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.script-coding.com/viewtopic.php?id=11392</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Cкрыть/показать строки контекстного меню "windows"]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=101855#p101855" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Ядрён пишет:</cite><blockquote><p><strong>serzh82saratov</strong><br />Почти уже , только вот на пустом месте когда кликаешь &quot;RButton&quot; ничего не происходит.</p></blockquote></div><p>У меня появляется, может у вас в нём нет тех пунктов, если после LShift нажать ничего нет?</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2016-03-15T14:12:17Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=101855#p101855</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Cкрыть/показать строки контекстного меню "windows"]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=101828#p101828" />
			<content type="html"><![CDATA[<p>Встроенное в windows решение для каждого пункта меню в отдельности:<br />добавлять пустой строковый параметр Extended в ...\shell\MyItem, где MyItem - раздел, отвечающий за пункт меню.<br />- не работает для пунктов, за показ которых отвечают библиотеки (notepad++).<br />Наглядная утилита от nirsoft - <a href="http://www.nirsoft.net/utils/shell_menu_view.html">http://www.nirsoft.net/utils/shell_menu_view.html</a><br />P.S. Упс, Malcev уже писал.</p>]]></content>
			<author>
				<name><![CDATA[stealzy]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=31937</uri>
			</author>
			<updated>2016-03-14T09:37:54Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=101828#p101828</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Cкрыть/показать строки контекстного меню "windows"]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=101811#p101811" />
			<content type="html"><![CDATA[<p><strong>serzh82saratov</strong><br />Почти уже , только вот на пустом месте когда кликаешь &quot;RButton&quot; ничего не происходит.</p>]]></content>
			<author>
				<name><![CDATA[Ядрён]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=30092</uri>
			</author>
			<updated>2016-03-12T23:30:00Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=101811#p101811</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Cкрыть/показать строки контекстного меню "windows"]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=101803#p101803" />
			<content type="html"><![CDATA[<p>Немного поправил, но до нормального варианта далеко.<br /></p><div class="codebox"><pre><code>
#SingleInstance Force
#NoEnv
SetBatchLines -1
#Persistent
CoordMode, Mouse
StringCaseSense, Locale

SetWinEventHook(&quot;EVENT_OBJECT_SHOW&quot;, 0x8002)
SetWinEventHook(&quot;EVENT_OBJECT_DESTROY&quot;, 0x8001)
Return

#If hWndMenu
LShift::
	NoRemove := 1
	WinClose, ahk_id %hWndMenu%
	MouseMove, menuX, menuY, 0
	Click Right
	KeyWait LShift
	NoRemove := 0
	If !hWndMenu
		Return
	WinClose, ahk_id %hWndMenu%
	MouseMove, menuX, menuY, 0
	Click Right
	Return 
#If

RemoveMenu(hWnd) {
	Global hWndMenu, menuX, menuY
	SendMessage, 0x1E1, 0, 0, , ahk_id %hwnd%		;	MN_GETHMENU
	If !(hMenu := ErrorLevel)
		Return
	WinSet, Region, 0-0 w0 h0, % &quot;ahk_id &quot; hwnd
	MouseGetPos, menuX, menuY
	hWndMenu := hWnd
	Loop, % DllCall(&quot;GetMenuItemCount&quot;, &quot;Uint&quot;, hMenu) + Index := 0
	{
		idx := Index++
		idn := DllCall(&quot;GetMenuItemID&quot;, &quot;Uint&quot;, hMenu, &quot;Int&quot;, idx)
		nSize++ := DllCall(&quot;GetMenuString&quot;, &quot;Uint&quot;, hMenu, &quot;Int&quot;, idx, &quot;Uint&quot;, 0, &quot;Int&quot;, 0, &quot;Uint&quot;, 0x400)
		nSize := (nSize * (A_IsUnicode ? 2 : 1))
		VarSetCapacity(String, nSize)
		DllCall(&quot;GetMenuString&quot;, &quot;Uint&quot;, hMenu, &quot;Int&quot;, idx, &quot;Str&quot;, String, &quot;Int&quot;, nSize, &quot;Uint&quot;, 0x400)		;	MF_BYPOSITION
		StringReplace, String, String, &amp;, , 1
		If String not in открыть,изменить,вырезать,копировать,создать ярлык,удалить,переименовать,свойства
			DllCall(&quot;RemoveMenu&quot;, &quot;Int&quot;, hMenu, &quot;UInt&quot;, idx, &quot;Uint&quot;, &quot;0x00000400&quot;), Index--
	}
	WinMove, % &quot;ahk_id &quot; hwnd, , menuX, menuY
	WinSet, Region, , % &quot;ahk_id &quot; hwnd
}

EVENT_OBJECT_SHOW(hWinEventHook, event, hwnd, idObject, idChild) {
	Global NoRemove, hWndMenu
	If (idObject || idChild)
		Return
	WinGetClass, Class, % &quot;ahk_id &quot; hwnd
	If Class != #32768
		Return
	WinGet, Process, ProcessName, % &quot;ahk_id &quot; hwnd
	If Process != explorer.exe
		Return
	If NoRemove
		hWndMenu := hwnd
	Else
		RemoveMenu(hWnd)
}

EVENT_OBJECT_DESTROY(hWinEventHook, event, hwnd, idObject, idChild) {
	Global hWndMenu
	If (idObject || idChild || hWndMenu != hwnd)
		Return
	hWndMenu := 0
}

SetWinEventHook(EventProc, eventMin, eventMax = 0)
{
	Return DllCall(&quot;SetWinEventHook&quot;
				, &quot;UInt&quot;, eventMin, &quot;UInt&quot;, eventMax := !eventMax ? eventMin : eventMax
				, &quot;Ptr&quot;, hmodWinEventProc := 0, &quot;Ptr&quot;, lpfnWinEventProc := RegisterCallback(EventProc, &quot;F&quot;)
				, &quot;UInt&quot;, idProcess := 0, &quot;UInt&quot;, idThread := 0
				, &quot;UInt&quot;, dwflags := 0x0 | 0x2, &quot;Ptr&quot;)	;	WINEVENT_OUTOFCONTEXT | WINEVENT_SKIPOWNPROCESS
}
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2016-03-11T23:06:25Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=101803#p101803</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Cкрыть/показать строки контекстного меню "windows"]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=101790#p101790" />
			<content type="html"><![CDATA[<p><strong>serzh82saratov</strong> ,то что нужно но только в нижней части экрана меню появляется значительно выше курсора. А так если бы доработать было бы просто супер.</p>]]></content>
			<author>
				<name><![CDATA[Ядрён]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=30092</uri>
			</author>
			<updated>2016-03-11T12:40:05Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=101790#p101790</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Cкрыть/показать строки контекстного меню "windows"]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=101782#p101782" />
			<content type="html"><![CDATA[<p>Можно и в таком направлении посмотреть.<br /></p><div class="codebox"><pre><code>
#SingleInstance Force
#NoEnv
SetBatchLines -1
#Persistent

StringCaseSense, Locale

SetWinEventHook(&quot;EVENT_OBJECT_SHOW&quot;, 0x8002) 
Return

RemoveMenu(hMenu, hWnd)
{   
	Loop, % DllCall(&quot;GetMenuItemCount&quot;, &quot;Uint&quot;, hMenu) + Index := 0
	{
		idx := Index++
		idn := DllCall(&quot;GetMenuItemID&quot;, &quot;Uint&quot;, hMenu, &quot;int&quot;, idx) 
		nSize++ := DllCall(&quot;GetMenuString&quot;, &quot;Uint&quot;, hMenu, &quot;int&quot;, idx, &quot;Uint&quot;, 0, &quot;int&quot;, 0, &quot;Uint&quot;, 0x400)
		nSize := (nSize * (A_IsUnicode ? 2 : 1)) 
		VarSetCapacity(sString, nSize)
		DllCall(&quot;GetMenuString&quot;, &quot;Uint&quot;, hMenu, &quot;int&quot;, idx, &quot;str&quot;, sString, &quot;int&quot;, nSize, &quot;Uint&quot;, 0x400)   ;MF_BYPOSITION 
		StringReplace, sString, sString, &amp;, , 1 
		If sString not in открыть,изменить,вырезать,копировать,создать ярлык,удалить,переименовать,свойства 
			DllCall(&quot;RemoveMenu&quot;,&quot;Int&quot;,hMenu,&quot;UInt&quot;,idx,&quot;Uint&quot;,&quot;0x00000400&quot;), Index--   
	} 
}

EVENT_OBJECT_SHOW(hWinEventHook, event, hwnd, idObject, idChild) {
	If (idObject || idChild)
		Return 
	WinGetClass, Class, % &quot;ahk_id &quot; hwnd
	If Class != #32768
		Return
	WinGet, Process, ProcessName, % &quot;ahk_id &quot; hwnd
	If Process != explorer.exe
		Return  
	SendMessage, 0x1E1, 0, 0, , ahk_id %hwnd%      ; MN_GETHMENU
	hMenu := ErrorLevel 
	RemoveMenu(hMenu, hWnd)    
}

SetWinEventHook(EventProc, eventMin, eventMax = 0)
{  
	Return DllCall(&quot;SetWinEventHook&quot;
				, &quot;UInt&quot;, eventMin, &quot;UInt&quot;, eventMax := !eventMax ? eventMin : eventMax
				, &quot;Ptr&quot;, hmodWinEventProc := 0, &quot;Ptr&quot;, lpfnWinEventProc := RegisterCallback(EventProc, &quot;F&quot;)
				, &quot;UInt&quot;, idProcess := 0, &quot;UInt&quot;, idThread := 0
				, &quot;UInt&quot;, dwflags := 0x0|0x2, &quot;Ptr&quot;)	;	WINEVENT_OUTOFCONTEXT | WINEVENT_SKIPOWNPROCESS 
} 
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2016-03-10T22:29:46Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=101782#p101782</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Cкрыть/показать строки контекстного меню "windows"]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=101781#p101781" />
			<content type="html"><![CDATA[<p>Вот софтинка есть:<br /><a href="http://www.nirsoft.net/utils/shell_menu_view.html">http://www.nirsoft.net/utils/shell_menu_view.html</a></p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2016-03-10T22:19:08Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=101781#p101781</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Cкрыть/показать строки контекстного меню "windows"]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=101780#p101780" />
			<content type="html"><![CDATA[<p>Вот тут подумал немного и кое что придумал ,а что если переименовывать ключ реестра &quot;HKEY_CLASSES_ROOT, *\shellex&quot; в &quot;HKEY_CLASSES_ROOT, *\shellex1&quot; при нажатии на &quot;RButton&quot;и переименовывать обратно при нажатии &quot;+RButton&quot;.По крайней мере при физическом переименовании (конкретно в реестре),очень много элементом контекстного меню пропадает.</p>]]></content>
			<author>
				<name><![CDATA[Ядрён]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=30092</uri>
			</author>
			<updated>2016-03-10T21:54:34Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=101780#p101780</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Cкрыть/показать строки контекстного меню "windows"]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=101779#p101779" />
			<content type="html"><![CDATA[<div class="quotebox"><blockquote><p>Но изменить контекстное меню вряд ли возможно</p></blockquote></div><p>Почему же? Как-раз таки весь мусор легко удалить.<br />Просто я понял задачу, что если после появления усеченного контексного меню, зажать шифт, то должны появиться дополнительные пункты. А если просто сделать 2 горячих кнопки, то можно так: <br /></p><div class="codebox"><pre><code>RButton::
CM_DelMenuItem( &quot;ahk&quot;, &quot;Test 1 2 3 &quot; )
Send {RButton down}
KeyWait, RButton
Send {RButton up}
return

+RButton::
CM_AddMenuItem( &quot;ahk&quot;, &quot;&amp;Test 1 2 3 &quot;, &quot;Notepad &quot;&quot;%1&quot;&quot;&quot; )
Send {RButton down}
KeyWait, RButton
Send {RButton up}
return

CM_AddMenuItem( ext, label, command ) {
  If( ext = &quot;&quot; or label = &quot;&quot; or command = &quot;&quot; )
    Return false
    
  CleanLabel := RegExReplace( label, &quot;\W&quot;, &quot;&quot; )
  RegRead FileType, HKCR, .%ext%
  If( Not FileType )
    Return false
    
  RegWrite REG_SZ, HKCR, %FileType%\shell\%CleanLabel%,, %label%
  RegWrite REG_SZ, HKCR, %FileType%\shell\%CleanLabel%\command,, %command%
  
  Return true
}


CM_DelMenuItem( ext, label ) {
  If( ext = &quot;&quot; or label = &quot;&quot; )
    Return false
    
  CleanLabel := RegExReplace( label, &quot;\W&quot;, &quot;&quot; )
  RegRead FileType, HKCR, .%ext%
  If( Not FileType )
    Return false
    
  RegDelete HKCR, %FileType%\shell\%CleanLabel%

  Return true
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2016-03-10T20:41:53Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=101779#p101779</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Cкрыть/показать строки контекстного меню "windows"]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=101778#p101778" />
			<content type="html"><![CDATA[<p>Я так и понял. Но изменить контекстное меню вряд ли возможно. Оно для разных объектов разное.<br />Можно проверять класс окна и объект под курсором. Если это Explorer и не зажат Shift, вызвать самодельное контекстное меню. Если это Explorer и зажат Shift, то послать щелчок ПКМ.</p>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2016-03-10T20:01:55Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=101778#p101778</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Cкрыть/показать строки контекстного меню "windows"]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=101777#p101777" />
			<content type="html"><![CDATA[<p>Так задача, как я понял, скрыть некоторые пункты меню, чтоб их не было видно.<br />Так как когда их много, то становится неудобно выбирать.<br />Но иногда они могут пригодиться, поэтому и показывать их при нажатии шифт.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2016-03-10T19:43:20Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=101777#p101777</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Cкрыть/показать строки контекстного меню "windows"]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=101776#p101776" />
			<content type="html"><![CDATA[<p>Зачем скрывать? Просто блокировать щелчок мыши. Ну а если скрывать, то можно нажатие Esc посылать.</p>]]></content>
			<author>
				<name><![CDATA[ypppu]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=5974</uri>
			</author>
			<updated>2016-03-10T19:39:11Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=101776#p101776</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Cкрыть/показать строки контекстного меню "windows"]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=101775#p101775" />
			<content type="html"><![CDATA[<p>Можно отслеживать правый клик мыши.<br />И при нажатии shift повторно кликать в то же место, но с уже добавленными пунктами.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2016-03-10T19:32:10Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=101775#p101775</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Cкрыть/показать строки контекстного меню "windows"]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=101774#p101774" />
			<content type="html"><![CDATA[<p>Да удалить через реестр не проблема ,а вот скрыть как?</p>]]></content>
			<author>
				<name><![CDATA[Ядрён]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=30092</uri>
			</author>
			<updated>2016-03-10T19:17:12Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=101774#p101774</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Cкрыть/показать строки контекстного меню "windows"]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=101773#p101773" />
			<content type="html"><![CDATA[<p>Полагаю никак. Некоторые системные пункты меню удаляются только через Resource Hacker.<br /><a href="http://www.sevenforums.com/customization/170036-remove-create-shortcut-file-folder-context-menu.html">http://www.sevenforums.com/customizatio … -menu.html</a><br />Остальные удаляются через реестр.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2016-03-10T18:39:28Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=101773#p101773</id>
		</entry>
</feed>
