<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Управление монитором, DDC/CI]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=13709&amp;type=atom" />
	<updated>2021-03-03T21:58:14Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=13709</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Управление монитором, DDC/CI]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=146605#p146605" />
			<content type="html"><![CDATA[<div class="quotebox"><blockquote><p>VESA MCCSStandard Reproduction ProhibitedVersion 2.2a©Copyright2006 –2011Video Electronics Standards AssociationPage 56of 131Table 8-4: Image Adjustment VCP CodesCodeNameTypeFunctionDescriptionDChDisplay ApplicationR/WNCPermits the selection of a preset optimized by manufacturer for an application type or the selection of a user defined setting.Byte: SL00hStand / default mode01hProductivity (e.g. office applications)02hMixed (e.g. internet with mix of text and images)03hMovie04hUser defined05hGames (e.g. games console / PC game)06hSports (e.g. fast action)07hProfessional (all signal processing disabled)08hStandard / default mode with intermediate power consumption09hStandard / default mode with low power consumption0AhDemonstration (used for high visual impact in retail etc.)0Bh-EFhReserved, must be ignoredF0hDynamic contrast≥ F1hReserved, must be ignoredNOTE:The condition(s) associated with options 00h→0Ah(inclusive) are defined by the display manufacturer and may include all or some of luminance, contrast, gamma settings, etc.</p></blockquote></div><p><a href="https://milek7.pl/ddcbacklight/mccs.pdf">https://milek7.pl/ddcbacklight/mccs.pdf</a></p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2021-03-03T21:58:14Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=146605#p146605</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Управление монитором, DDC/CI]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=146602#p146602" />
			<content type="html"><![CDATA[<p>Прочитал всю тему, но так и не понял, можно ли переключать режимы. Например, со стандартного на игровой?</p>]]></content>
			<author>
				<name><![CDATA[Foma]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=31521</uri>
			</author>
			<updated>2021-03-03T17:50:50Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=146602#p146602</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Управление монитором, DDC/CI]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=142415#p142415" />
			<content type="html"><![CDATA[<p>Да, показывает правильно оба монитора.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2020-10-02T07:41:24Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=142415#p142415</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Управление монитором, DDC/CI]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=142414#p142414" />
			<content type="html"><![CDATA[<p><strong>serzh82saratov</strong>, так показывает у тебя?<br /></p><div class="codebox"><pre><code>DllCall(&quot;GetDisplayConfigBufferSizes&quot;, &quot;uint&quot;, QDC_ONLY_ACTIVE_PATHS := 2, &quot;uint*&quot;, numPathArrayElements, &quot;uint*&quot;, numModeInfoArrayElements)
VarSetCapacity(DISPLAYCONFIG_PATH_INFO, (20+48+4)*numPathArrayElements, 0)
VarSetCapacity(DISPLAYCONFIG_MODE_INFO, 64*numModeInfoArrayElements, 0)
DllCall(&quot;QueryDisplayConfig&quot;, &quot;uint&quot;, QDC_ONLY_ACTIVE_PATHS := 2, &quot;ptr&quot;, &amp;numPathArrayElements, &quot;ptr&quot;, &amp;DISPLAYCONFIG_PATH_INFO, &quot;ptr&quot;, &amp;numModeInfoArrayElements, &quot;ptr&quot;, &amp;DISPLAYCONFIG_MODE_INFO, &quot;uint&quot;, 0)
loop % NumGet(numPathArrayElements, &quot;int&quot;)
{
   adapterId := NumGet(DISPLAYCONFIG_PATH_INFO, (A_Index-1)*72+20, &quot;int64&quot;)
   id := NumGet(DISPLAYCONFIG_PATH_INFO, (A_Index-1)*72+28, &quot;uint&quot;)
   VarSetCapacity(DISPLAYCONFIG_TARGET_DEVICE_NAME, 420, 0)
   NumPut(DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_NAME := 2, DISPLAYCONFIG_TARGET_DEVICE_NAME, 0, &quot;uint&quot;)
   NumPut(420, DISPLAYCONFIG_TARGET_DEVICE_NAME, 4, &quot;uint&quot;)
   NumPut(adapterId, DISPLAYCONFIG_TARGET_DEVICE_NAME, 8, &quot;int64&quot;)
   NumPut(id, DISPLAYCONFIG_TARGET_DEVICE_NAME, 16, &quot;uint&quot;)
   DllCall(&quot;DisplayConfigGetDeviceInfo&quot;, &quot;ptr&quot;, &amp;DISPLAYCONFIG_TARGET_DEVICE_NAME)
   MsgBox, % StrGet(&amp;DISPLAYCONFIG_TARGET_DEVICE_NAME + 36)
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2020-10-02T00:52:20Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=142414#p142414</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Управление монитором, DDC/CI]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=131347#p131347" />
			<content type="html"><![CDATA[<p>Размер члена структуры можно смотреть, не создавая структуры.<br /></p><div class="codebox"><pre><code>
sizeof(DISPLAYCONFIG_TARGET_DEVICE_NAME::monitorDevicePath)
</code></pre></div><p>А вот смещение, похоже, никак не узнаешь без создания. Или я не знаю как. Так что проще всего, думаю, создать её и потом уже использовать саму переменную для sizeof и для getOffset.</p>]]></content>
			<author>
				<name><![CDATA[YMP]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=81</uri>
			</author>
			<updated>2019-01-17T15:32:36Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=131347#p131347</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Управление монитором, DDC/CI]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=131344#p131344" />
			<content type="html"><![CDATA[<p>stdafx.h в консольном есть, а в пустом проекте много файлов, может это одно из отличий. То есть вы консольное используете потому что в нём есть файлы, а так отличий нет.<br /></p><div class="quotebox"><cite>YMP пишет:</cite><blockquote><p>А зачем Professional? Есть же бесплатная Community</p></blockquote></div><p>Оказалось что она была установлена, пока не хочется что то трогать.<br /></p><div class="quotebox"><cite>YMP пишет:</cite><blockquote><p>Их нужно сначала объявлять вверху файла, как я объявил getOffset, а само определение функции с её кодом может быть под или над main, без разницы.</p></blockquote></div><p>Спасибо, получилось.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2019-01-17T14:34:35Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=131344#p131344</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Управление монитором, DDC/CI]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=131343#p131343" />
			<content type="html"><![CDATA[<p>А зачем Professional? Есть же бесплатная Community. А то вот уже и stdafx.h почему-то нет, дальше больше, и трудно будет синхронизировать наш с вами опыт. Файл этот автоматически у меня создаётся при создании проекта, когда выбираю тип консольное приложение. Если пустой проект, то там не будет никаких файлов и нужно все самому потом создавать.</p><p>Все файлы cpp из проекта в итоге собираются в один экзешник (или dll), так что одинаковых функций не должно быть в разных файлах. Да, main — это точка входа в программу. Из неё и можно вызывать другие функции. Их нужно сначала объявлять вверху файла, как я объявил getOffset, а само определение функции с её кодом может быть под или над main, без разницы.</p>]]></content>
			<author>
				<name><![CDATA[YMP]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=81</uri>
			</author>
			<updated>2019-01-17T14:03:17Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=131343#p131343</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Управление монитором, DDC/CI]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=131342#p131342" />
			<content type="html"><![CDATA[<div class="quotebox"><blockquote><p>Microsoft Visual Studio Professional 2017 <br />Версия 15.7.4</p></blockquote></div><p>Не нашёл такого файла, они там по алфавиту, вряд ли я мог пропустить. Я создал таковой, всё работает.<br /></p><div class="quotebox"><blockquote><p>1&gt;SizeOf.obj : error LNK2005: main уже определен в getOffset.obj<br />1&gt;C:\Users\Sergio\Desktop\SizeOf\x64\Debug\SizeOf.exe : fatal error LNK1169: обнаружен многократно определенный символ - один или более</p></blockquote></div><p>А возможно запускать срр файлы в одном проекте отдельно от других? <br />То есть чтобы запустить один, надо в остальных переименовать функцию main.<br />И как в один файл добавить функции, и сверху вызывать нужную. main я так понял функция которая запускается при загрузке. Тяжёлый синтаксис, не пойму даже как функции вызывать.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2019-01-17T13:17:12Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=131342#p131342</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Управление монитором, DDC/CI]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=131341#p131341" />
			<content type="html"><![CDATA[<p>Смещения членов структуры можно, например, так узнавать.<br /></p><div class="codebox"><pre><code>
#include &quot;stdafx.h&quot;
using namespace std;

UINT getOffset(void* struct_ptr, void* member_ptr);

int main()
{
    DISPLAYCONFIG_TARGET_DEVICE_NAME s;
    cout &lt;&lt; getOffset(&amp;s, &amp;s.monitorDevicePath) &lt;&lt; endl;
    system(&quot;echo. &amp;&amp; pause&quot;);
    return 0;
}

UINT getOffset(void* struct_ptr, void* member_ptr)
{
    return (BYTE*) member_ptr - (BYTE*) struct_ptr;
}
</code></pre></div><p>Функция getOffset — для удобства преобразования типов, чтобы не возиться с этим в строке вывода. В С++ указатели тоже имеют разные типы. Поэтому просто вычесть указатель на один тип из указателя на другой не получится. Кроме того, если, например, вычесть один указатель на UINT из другого, то разница будет тоже в UINT&#039;ах, а не в байтах.</p>]]></content>
			<author>
				<name><![CDATA[YMP]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=81</uri>
			</author>
			<updated>2019-01-17T12:43:29Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=131341#p131341</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Управление монитором, DDC/CI]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=131339#p131339" />
			<content type="html"><![CDATA[<p>Сама VS, по-моему, только и есть 32-битная. А битность проекта выбирается на панели инструментов из списка: x86 или x64. Соответственно этому будет и размер типов.</p><p>stdafx.h надо искать на вкладке Solution Explorer, там все файлы проекта видно.</p>]]></content>
			<author>
				<name><![CDATA[YMP]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=81</uri>
			</author>
			<updated>2019-01-17T12:32:02Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=131339#p131339</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Управление монитором, DDC/CI]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=131334#p131334" />
			<content type="html"><![CDATA[<p><strong>YMP</strong><br />Спасибо за подробный ответ.<br />stdafx.h не нашёл, просто прописал перед main.<br />У меня VS х32, это влияет на sizeof? То есть как понять под какую битность она выдаёт размеры.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2019-01-17T11:43:18Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=131334#p131334</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Управление монитором, DDC/CI]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=131319#p131319" />
			<content type="html"><![CDATA[<p>Если нужен вывод в hex, то можно так:<br /></p><div class="codebox"><pre><code>
cout &lt;&lt; &quot;0x&quot; &lt;&lt; hex &lt;&lt; uppercase &lt;&lt; sizeof(DISPLAYCONFIG_TARGET_DEVICE_NAME) &lt;&lt; endl;
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[YMP]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=81</uri>
			</author>
			<updated>2019-01-17T06:35:57Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=131319#p131319</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Управление монитором, DDC/CI]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=131318#p131318" />
			<content type="html"><![CDATA[<p>Да, в stdafx.h я добавил<br /></p><div class="codebox"><pre><code>
#include &lt;windows.h&gt;
#include &lt;iostream&gt;</code></pre></div><p>А файл .cpp выглядит так:<br /></p><div class="codebox"><pre><code>#include &quot;stdafx.h&quot;
using namespace std;

int main()
{
	wcout &lt;&lt; sizeof(DISPLAYCONFIG_TARGET_DEVICE_NAME) &lt;&lt; endl;
	system(&quot;echo. &amp;&amp; pause&quot;);
    return 0;
}</code></pre></div><p>wcout — это вывод Юникодного текста. Конкретно здесь можно и просто cout, вывод в ANSI.</p>]]></content>
			<author>
				<name><![CDATA[YMP]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=81</uri>
			</author>
			<updated>2019-01-17T06:27:00Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=131318#p131318</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Управление монитором, DDC/CI]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=131317#p131317" />
			<content type="html"><![CDATA[<p>Ясненько.<br /></p><div class="quotebox"><cite>YMP пишет:</cite><blockquote><p>Вот всего лишь.<br /></p><div class="codebox"><pre><code>int main()
{
	wcout &lt;&lt; sizeof(DISPLAYCONFIG_TARGET_DEVICE_NAME) &lt;&lt; endl;
	system(&quot;echo. &amp;&amp; pause&quot;);
    return 0;
}</code></pre></div></blockquote></div><p>Пишет:<br /></p><div class="quotebox"><blockquote><p>идентификатор &quot;DISPLAYCONFIG_TARGET_DEVICE_NAME&quot; не определен</p></blockquote></div><p>Нужно что то &quot;заинклудить&quot; или как то объявить DISPLAYCONFIG_TARGET_DEVICE_NAME?</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2019-01-17T06:17:09Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=131317#p131317</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Управление монитором, DDC/CI]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=131316#p131316" />
			<content type="html"><![CDATA[<p>В этом проблема с отсутствием строгой типизации переменных. С одной стороны проще, а с другой: как дать АНК понять, что результат инверсии должен быть 64-битным? Хрен его знает. Сиди и голову ломай. Может, во второй версии этой проблемы нет.</p><div class="quotebox"><cite>serzh82saratov пишет:</cite><blockquote><p>Не могу из этого сделать выводы, можете своими словами объяснить принцип действия.</p></blockquote></div><p>При инверсии 1 становится 0, а &amp; с 0 даёт 0 в любом случае. Остальные биты, бывшие 0, становятся 1, а &amp; с 1 даёт 1, если была 1, и 0, если был 0. Т.е. там ничего в Number не изменится. Но т.к. АНК сокращает второй операнд до 32 бит, то выше 32 бит получаются нули, которые обнуляют и верхнюю половину Number.</p>]]></content>
			<author>
				<name><![CDATA[YMP]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=81</uri>
			</author>
			<updated>2019-01-17T06:11:59Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=131316#p131316</id>
		</entry>
</feed>
