<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Регистрация скомпилированного скрипта в качестве службы]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=11411&amp;type=atom" />
	<updated>2016-03-17T21:12:10Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=11411</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Регистрация скомпилированного скрипта в качестве службы]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=101915#p101915" />
			<content type="html"><![CDATA[<p><span style="color: green"><strong>chippp</strong>, ознакомьтесь с <a href="http://forum.script-coding.com/viewtopic.php?id=6148">этой</a> темой, отредактируйте свои посты.</span></p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2016-03-17T21:12:10Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=101915#p101915</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Регистрация скомпилированного скрипта в качестве службы]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=101911#p101911" />
			<content type="html"><![CDATA[<p>Ну и для дополнения тут<br /><a href="https://autohotkey.com/board/topic/32023-service-function-set-for-handling-windows-services/page-2">https://autohotkey.com/board/topic/3202 … ces/page-2</a></p>]]></content>
			<author>
				<name><![CDATA[chippp]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=28524</uri>
			</author>
			<updated>2016-03-17T19:26:16Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=101911#p101911</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Регистрация скомпилированного скрипта в качестве службы]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=101909#p101909" />
			<content type="html"><![CDATA[<p>Тут вполне рабочий пример <br /><a href="https://autohotkey.com/board/topic/66688-ahk-as-a-service/%20">https://autohotkey.com/board/topic/6668 … -service/ </a></p>]]></content>
			<author>
				<name><![CDATA[chippp]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=28524</uri>
			</author>
			<updated>2016-03-17T19:18:50Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=101909#p101909</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Регистрация скомпилированного скрипта в качестве службы]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=101903#p101903" />
			<content type="html"><![CDATA[<p>Присоединяюсь к вопросу, нашел интересное описание <a href="http://www.achatfs.narod.ru/create_services_api.html">http://www.achatfs.narod.ru/create_services_api.html</a> осталось разобраться но в этом не силен.</p>]]></content>
			<author>
				<name><![CDATA[chippp]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=28524</uri>
			</author>
			<updated>2016-03-17T18:40:44Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=101903#p101903</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Регистрация скомпилированного скрипта в качестве службы]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=101850#p101850" />
			<content type="html"><![CDATA[<p>А почему бы просто не создать в планировщике задачу с триггером при запуске/входе в систему/блокировании раб. станции?</p>]]></content>
			<author>
				<name><![CDATA[Flasher]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27593</uri>
			</author>
			<updated>2016-03-15T04:25:34Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=101850#p101850</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Регистрация скомпилированного скрипта в качестве службы]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=101849#p101849" />
			<content type="html"><![CDATA[<p>Задался таким вопросом... Есть скомпилированный скрипт, функционал которого меня полностью устраивает. Не хватает только &quot;одной мелочи&quot;, которая обсуждалась уже 100500 раз. Необходима реакция на хоткей до входа в систему. Много разговоров велось о том, что можно запустить такой скомпилированный в exe-шник скрипт, в качестве win-службы.</p><p>Всё бы ничего, но только регистрация службы при помощи посредников(ака servany, runassvc....) не даёт ничего, потому как запущенная служба не реагирует на хоткеи даже на рабочем столе, а не то, что в процессе логона.</p><p>Запуск же службы прямым указанием на мой exe-шник, оборачиваетcя ошибкой 1053. Погуглив, понял, что exe-шник работающий в качестве службы, должен иметь специальные директивы, на основании которых он и опознаётся как &quot;правильная служба&quot;. В противном же случае, Windows грохает процесс.</p><p>Я так же уже ознакомился с тем, что начиная с Win Vista, службы не могут иметь GUI, однако мой скрипт в нём и не нуждается. Полагаю, что есть ограничение и на взаимодействия через клавиатуру(в нашем случае через хоткеи). Это так?</p><p>Вот здесь:<br /><a href="https://autohotkey.com/boards/viewtopic.php?f=5&amp;t=5894&amp;p=76017#p76017">https://autohotkey.com/boards/viewtopic … 017#p76017</a><br />я нашёл пример скрипта, в котором как я понимаю обрабатываются указанные выше директивы:<br /></p><div class="codebox"><pre><code>CreateService(lpServiceName,lpDisplayName,lpBinaryPathName,dwServiceType=&quot;0x10&quot;,dwStartType=&quot;0x2&quot;,dwErrorControl=&quot;0x0&quot;)
{
	/*
	;------------dwServiceType--------------------
	0x00000001 ;SERVICE_KERNEL_DRIVER
	0x00000002 ;SERVICE_FILE_SYSTEM_DRIVER
	0x00000010 ;SERVICE_WIN32_OWN_PROCESS
	0x00000020 ;SERVICE_WIN32_SHARE_PROCESS
	;------------------------------------------------
 
	;------------dwStartType-----------------------
	0x00000000 ;SERVICE_BOOT_START
	0x00000001 ;SERVICE_SYSTEM_START
	0x00000002 ;SERVICE_AUTO_START
	0x00000003 ;SERVICE_DEMAND_START
	;------------------------------------------------
 
	;------------dwErrorControl-----------------------
	0x00000000 ;SERVICE_ERROR_IGNORE
	0x00000001 ;SERVICE_ERROR_NORMAL
	0x00000002 ;SERVICE_ERROR_SEVERE
	0x00000003 ;SERVICE_ERROR_CRITICAL
	;------------------------------------------------
	*/	
	SC_MANAGER_CREATE_SERVICE := 0x0002
	SERVICE_ALL_ACCESS := 0xF01FF
	hSC := DllCall(&quot;Advapi32\OpenSCManager&quot;,&quot;Uint&quot;,0,&quot;Uint&quot;,0,&quot;Uint&quot;,SC_MANAGER_CREATE_SERVICE,&quot;Uint&quot;)
	if not hSC
	{
		ErrorLevel := -1
		return,A_LastError
	}
	hCS := DllCall(&quot;Advapi32\CreateService&quot;,&quot;Uint&quot;,hSC
	,&quot;Str&quot;,lpServiceName
	,&quot;Str&quot;,lpDisplayName
	,&quot;Uint&quot;,SERVICE_ALL_ACCESS 								
	,&quot;Uint&quot;,dwServiceType
	,&quot;Uint&quot;,dwStartType
	,&quot;Uint&quot;,dwErrorControl
	,&quot;Str&quot;,lpBinaryPathName
	,&quot;Uint&quot;,0
	,&quot;Uint&quot;,0
	,&quot;Uint&quot;,0
	,&quot;Uint&quot;,0
	,&quot;Uint&quot;,0
	,&quot;Uint&quot;)
	if not hCS
	{
		DllCall(&quot;Advapi32\CloseServiceHandle&quot;,&quot;Ptr&quot;,hSC)
		ErrorLevel := -2
		return,A_LastError
	}	
	DllCall(&quot;Advapi32\CloseServiceHandle&quot;,&quot;Ptr&quot;,hSC)
	DllCall(&quot;Advapi32\CloseServiceHandle&quot;,&quot;Ptr&quot;,hCS)
	ErrorLevel := 0
	return
}</code></pre></div><p>однако вставка этого кода в начало моего скрипта ничем не помогает..(((</p><p>Уже давно отказался бы от этой навязчивой идеи... но вот загвоздка... ))) по интернету полно примеров скриптов AHK, которые будто бы всё же запускаются как службы. И если кто то это делал, значит они всё-таки могут взаимодействовать через клавиатуру, иначе какой в этом смысл? В любом случае или кривые руки или устаревшие примеры(многие из примеров в сети были рассчитаны на XP и Win7), мне же нужен рабочий вариант для Win8.1 и Win10.</p><p>Может ли кто-то что-нибудь подсказать по этой теме? Был бы весьма признателен....</p>]]></content>
			<author>
				<name><![CDATA[taravasya]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=33758</uri>
			</author>
			<updated>2016-03-15T03:12:49Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=101849#p101849</id>
		</entry>
</feed>
