<?xml version='1.0' encoding="utf-8"?>
      <rss version='2.0'>
      <channel>
      <title>Форум на Исходниках.RU</title>
      <link>https://forum.sources.ru</link>
      <description>Форум на Исходниках.RU</description>
      <generator>Форум на Исходниках.RU</generator>
  	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=51438&amp;view=findpost&amp;p=461218</guid>
        <pubDate>Sat, 18 Sep 2004 04:06:55 +0000</pubDate>
        <title>Ка изменить разрешение экрана</title>
        <link>https://forum.sources.ru/index.php?showtopic=51438&amp;view=findpost&amp;p=461218</link>
        <description><![CDATA[Vasya2000: <div class='tag-quote'><span class='tag-quote-prefix'>Цитата</span> <div class='quote '><strong class='tag-b'>SCINER</strong><br>
Вот все исходники:<br>
Суть: перебор 5 методов в лоб.<br>
Хоть один да сработает. :) :) :)</div></div>]]></description>
        <author>Vasya2000</author>
        <category>Работа с Windows</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=51438&amp;view=findpost&amp;p=338774</guid>
        <pubDate>Thu, 15 Apr 2004 08:19:39 +0000</pubDate>
        <title>Ка изменить разрешение экрана</title>
        <link>https://forum.sources.ru/index.php?showtopic=51438&amp;view=findpost&amp;p=338774</link>
        <description><![CDATA[Vasya2000: <strong class='tag-b'>tnx for XPraptor</strong> <br>
вариант1<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">&#39;Декларируем API функции</div><div class="code_line">Public Declare Function ChangeDisplaySettings Lib &quot;user32&quot; Alias &quot;ChangeDisplaySettingsA&quot; (lpDevMode As Any, ByVal dwflags As Long) As Long</div><div class="code_line">Public Declare Function EnumDisplaySettings Lib &quot;user32&quot; Alias &quot;EnumDisplaySettingsA&quot; (ByVal lpszDeviceName As Long, ByVal iModeNum As Long, lpDevMode As Any) As Boolean</div><div class="code_line">Public Declare Function GetDeviceCaps Lib &quot;gdi32&quot; (ByVal hDC As Long, ByVal nIndex As Long) As Long</div><div class="code_line">Public Declare Function GetDC Lib &quot;user32&quot; (ByVal hwnd As Long) As Long</div><div class="code_line">Public Declare Function ReleaseDC Lib &quot;user32&quot; (ByVal hwnd As Long, ByVal hDC As Long) As Long</div><div class="code_line">Public Declare Function GetDesktopWindow Lib &quot;user32&quot; () As Long</div><div class="code_line">&nbsp;</div><div class="code_line">&#39;Объявляем глобальные константы и типы</div><div class="code_line">Public Const DRIVERVERSION = 0 &nbsp; &nbsp; &nbsp;&#39; &nbsp;Device driver version</div><div class="code_line">Public Const TECHNOLOGY = 2 &nbsp; &nbsp; &nbsp; &nbsp; &#39; &nbsp;Device classification</div><div class="code_line">Public Const HORZSIZE = 4 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39; &nbsp;Horizontal size in millimeters</div><div class="code_line">Public Const VERTSIZE = 6 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39; &nbsp;Vertical size in millimeters</div><div class="code_line">Public Const HORZRES = 8 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#39; &nbsp;Horizontal width in pixels</div><div class="code_line">Public Const VERTRES = 10 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39; &nbsp;Vertical width in pixels</div><div class="code_line">Public Const BITSPIXEL = 12 &nbsp; &nbsp; &nbsp; &nbsp; &#39; &nbsp;Number of bits per pixel</div><div class="code_line">Public Const PLANES = 14 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#39; &nbsp;Number of planes</div><div class="code_line">Public Const NUMBRUSHES = 16 &nbsp; &nbsp; &nbsp; &nbsp;&#39; &nbsp;Number of brushes the device has</div><div class="code_line">Public Const NUMPENS = 18 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39; &nbsp;Number of pens the device has</div><div class="code_line">Public Const NUMMARKERS = 20 &nbsp; &nbsp; &nbsp; &nbsp;&#39; &nbsp;Number of markers the device has</div><div class="code_line">Public Const NUMFONTS = 22 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#39; &nbsp;Number of fonts the device has</div><div class="code_line">Public Const NUMCOLORS = 24 &nbsp; &nbsp; &nbsp; &nbsp; &#39; &nbsp;Number of colors the device supports</div><div class="code_line">Public Const PDEVICESIZE = 26 &nbsp; &nbsp; &nbsp; &#39; &nbsp;Size required for device descriptor</div><div class="code_line">Public Const CURVECAPS = 28 &nbsp; &nbsp; &nbsp; &nbsp; &#39; &nbsp;Curve capabilities</div><div class="code_line">Public Const LINECAPS = 30 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#39; &nbsp;Line capabilities</div><div class="code_line">Public Const POLYGONALCAPS = 32 &nbsp; &nbsp; &#39; &nbsp;Polygonal capabilities</div><div class="code_line">Public Const TEXTCAPS = 34 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#39; &nbsp;Text capabilities</div><div class="code_line">Public Const CLIPCAPS = 36 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#39; &nbsp;Clipping capabilities</div><div class="code_line">Public Const RASTERCAPS = 38 &nbsp; &nbsp; &nbsp; &nbsp;&#39; &nbsp;Bitblt capabilities</div><div class="code_line">Public Const ASPECTX = 40 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39; &nbsp;Length of the X leg</div><div class="code_line">Public Const ASPECTY = 42 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39; &nbsp;Length of the Y leg</div><div class="code_line">Public Const ASPECTXY = 44 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#39; &nbsp;Length of the hypotenuse</div><div class="code_line">&nbsp;</div><div class="code_line">Public Const LOGPIXELSX = 88 &nbsp; &nbsp; &nbsp; &nbsp;&#39; &nbsp;Logical pixels/inch in X</div><div class="code_line">Public Const LOGPIXELSY = 90 &nbsp; &nbsp; &nbsp; &nbsp;&#39; &nbsp;Logical pixels/inch in Y</div><div class="code_line">&nbsp;</div><div class="code_line">Public Const SIZEPALETTE = 104 &nbsp; &nbsp; &nbsp;&#39; &nbsp;Number of entries in physical palette</div><div class="code_line">Public Const NUMRESERVED = 106 &nbsp; &nbsp; &nbsp;&#39; &nbsp;Number of reserved entries in palette</div><div class="code_line">Public Const COLORRES = 108 &nbsp; &nbsp; &nbsp; &nbsp; &#39; &nbsp;Actual color resolution</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">Public Const DM_BITSPERPEL = &amp;H40000</div><div class="code_line">Public Const DM_PELSWIDTH = &amp;H80000</div><div class="code_line">Public Const DM_PELSHEIGHT = &amp;H100000</div><div class="code_line">Public Const CCFORMNAME = 32</div><div class="code_line">Public Const CCDEVICENAME = 32</div><div class="code_line">&nbsp;</div><div class="code_line">Public Type DEVMODE</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmDeviceName As String * CCDEVICENAME</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmSpecVersion As Integer</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmDriverVersion As Integer</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmSize As Integer</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmDriverExtra As Integer</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmFields As Long</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmOrientation As Integer</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmPaperSize As Integer</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmPaperLength As Integer</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmPaperWidth As Integer</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmScale As Integer</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmCopies As Integer</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmDefaultSource As Integer</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmPrintQuality As Integer</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmColor As Integer</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmDuplex As Integer</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmYResolution As Integer</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmTTOption As Integer</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmCollate As Integer</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmFormName As String * CCFORMNAME</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmUnusedPadding As Integer</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmBitsPerPel As Integer</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmPelsWidth As Long</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmPelsHeight As Long</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmDisplayFlags As Long</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmDisplayFrequency As Long</div><div class="code_line">End Type</div><div class="code_line">&nbsp;</div><div class="code_line">&#39;Получает текущее разрешение экрана</div><div class="code_line">Public Sub GetVideoMode(ByRef Width As Long, ByRef height As Long, ByRef Depth As Long)</div><div class="code_line">Dim hDC As Long &#39;Контекст устройства</div><div class="code_line">&nbsp;&nbsp;On Error GoTo errDebug</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp;hDC = GetDC(GetDesktopWindow()) &#39;Получаем контекст учтройства (Desktop)</div><div class="code_line">&nbsp;&nbsp;Width = GetDeviceCaps(hDC, HORZRES) &#39;Получаем ширину экрана в пикселях</div><div class="code_line">&nbsp;&nbsp;height = GetDeviceCaps(hDC, VERTRES) &#39;Получаем высоту экрана в пикселях</div><div class="code_line">&nbsp;&nbsp;Depth = GetDeviceCaps(hDC, BITSPIXEL) &#39;Получаем глубину цвета (4=16ц, 8=256ц, 12=16H ц, 16=32H ц)</div><div class="code_line">&nbsp;&nbsp;ReleaseDC GetDesktopWindow(), hDC &#39;Освобождаем устройство</div><div class="code_line">&nbsp;&nbsp; &nbsp;Exit Sub</div><div class="code_line">errDebug:</div><div class="code_line">&nbsp;&nbsp; &nbsp;&#39;Обрабатываем возникшие ошибки</div><div class="code_line">End Sub</div><div class="code_line">&nbsp;</div><div class="code_line">&#39;Изменяет Текущее разрешение Экрана</div><div class="code_line">Public Sub ChangeResolution(ByRef iWidth As Long, ByRef iHeigh As Long, ByRef iDepth As Integer, ByRef iFreq As Long, Auto As Boolean)</div><div class="code_line">Dim DevM As DEVMODE</div><div class="code_line">Dim a As Boolean</div><div class="code_line">Dim i As Long</div><div class="code_line">Dim b As Long</div><div class="code_line">&nbsp;</div><div class="code_line">Dim freqs&amp; &#39;Частота регенерации</div><div class="code_line">Dim Wd&amp; &#39;Ширина pxl</div><div class="code_line">Dim Hg&amp; &#39;Высота pxl</div><div class="code_line">Dim Dept% &#39;Глубина цвета</div><div class="code_line">&nbsp;</div><div class="code_line">Dim mxfreqs&amp;</div><div class="code_line">Dim mxWd&amp;</div><div class="code_line">Dim mxHg&amp;</div><div class="code_line">Dim mxDept%</div><div class="code_line">Dim DevName$</div><div class="code_line">&nbsp;</div><div class="code_line">i = 0</div><div class="code_line">mxfreqs&amp; = 0</div><div class="code_line">mxWd&amp; = 0</div><div class="code_line">mxHg&amp; = 0</div><div class="code_line">mxDept% = 0</div><div class="code_line">Do While i &#60; 10000</div><div class="code_line">&nbsp;&nbsp; &nbsp;a = EnumDisplaySettings(0&amp;, i&amp;, DevM) &#39;Проходим по всему списку поддерживаемых параметров монитора</div><div class="code_line">&nbsp;&nbsp; &nbsp;If a &#60;&#62; False Then</div><div class="code_line">&nbsp;&nbsp; &nbsp;If Auto = True Then &#39;Если = True, то программа сама попытается выставить максимально возможные параметры для данного монитора</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;freqs = DevM.dmDisplayFrequency</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Wd = DevM.dmPelsWidth</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Hg = DevM.dmPelsHeight</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Dept = DevM.dmBitsPerPel</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;If freqs &#62;= mxfreqs And Wd = iWidth And Hg = iHeigh And Dept &#62;= mxDept Then</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;mxfreqs = freqs</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;If Wd = iWidth Then mxWd&amp; = Wd&amp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;If Hg = iHeigh Then mxHg&amp; = Hg&amp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;mxDept% = Dept%</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;End If</div><div class="code_line">&nbsp;&nbsp; &nbsp;End If</div><div class="code_line">&nbsp;&nbsp; &nbsp;Else</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Exit Do</div><div class="code_line">&nbsp;&nbsp; &nbsp;End If</div><div class="code_line">&nbsp;&nbsp; &nbsp;i = i + 1</div><div class="code_line">Loop</div><div class="code_line">If Auto = True Then</div><div class="code_line">&nbsp;&nbsp; &nbsp;DevM.dmPelsWidth = mxWd</div><div class="code_line">&nbsp;&nbsp; &nbsp;DevM.dmPelsHeight = mxHg</div><div class="code_line">&nbsp;&nbsp; &nbsp;DevM.dmBitsPerPel = mxDept</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;If mxfreqs &#62; 110 Then &#39;Если максимальная частота регенерации высокая, значит в установках монитора не стоит check &quot;Скрывать частоту не поддерживаемую монитором и программа выставляет 60Hz&quot;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;DevM.dmDisplayFrequency = 60</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Else</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;DevM.dmDisplayFrequency = mxfreqs</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;End If</div><div class="code_line">Else &#39;Если Auto=False, то монитору устанавливаются параметры указанные при вызове процедуры</div><div class="code_line">&nbsp;&nbsp; &nbsp;DevM.dmPelsWidth = iWidth</div><div class="code_line">&nbsp;&nbsp; &nbsp;DevM.dmPelsHeight = iHeigh</div><div class="code_line">&nbsp;&nbsp; &nbsp;DevM.dmBitsPerPel = iDepth</div><div class="code_line">&nbsp;&nbsp; &nbsp;DevM.dmDisplayFrequency = iFreq</div><div class="code_line">End If</div><div class="code_line">b = ChangeDisplaySettings(DevM, 1) &#39;Применяются новые параметры</div><div class="code_line">&#39;&#39;&#39;&#39;&#39;&#39;&#39;&#39;&#39;&#39;&#39;</div><div class="code_line">&#39;здесь можно разместить код включения таймера, если параметры не поддерживаются монитором</div><div class="code_line">&#39;&#39;&#39;&#39;&#39;&#39;&#39;&#39;&#39;&#39;</div><div class="code_line">End Sub</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&#39;Вызываются следующим образом:</div><div class="code_line">&#39;Sub DetectScreen () </div><div class="code_line">&#39;Dim Wd As Long</div><div class="code_line">&#39;Dim Hg As Long</div><div class="code_line">&#39;Dim Dpt As Long</div><div class="code_line">&#39; &nbsp; GetVideoMode Wd, Hg, Dpt</div><div class="code_line">&#39; Теперь Wd, Hg и Dpt равны параметрам экрана</div><div class="code_line">&#39;Для изменеия вызываем:</div><div class="code_line">&#39;Call ChangeResolution(1024, 768, 16, 100, False)</div><div class="code_line">&#39;или</div><div class="code_line">&#39;Call ChangeResolution(0, 0, 0, 0, True)&#39;Для автоматического определения</div><div class="code_line">&#39;End Sub</div><div class="code_line">&nbsp;</div><div class="code_line">&#39;Желаю успехов в нелегком деле программирования (XPraptor)</div></ol></div></div></div></div><script>preloadCodeButtons('1');</script> <br>
<br>
<strong class='tag-b'>tnx for Ruben</strong> <br>
вариант2<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">&#39;//ЧТОБЫ ЭТОТ ПРОЕКТ РАБОТАЛ ПОНАДОБИТСЯ DIRECTX7</div><div class="code_line">&#39;//ЗАЙДИ В PROJECT&#62;REFERENCES И ДОБАВЬ &quot;DirectX 7 for Visual Basic Type Library&quot;</div><div class="code_line">&nbsp;</div><div class="code_line">Dim dx7 As New DirectX7</div><div class="code_line">Dim dd As DirectDraw7</div><div class="code_line">&nbsp;</div><div class="code_line">Private Sub Form_Load()</div><div class="code_line">&nbsp;&nbsp; Init</div><div class="code_line">End Sub</div><div class="code_line">&nbsp;</div><div class="code_line">Sub Init()</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; Set dd = dx7.DirectDrawCreate(&quot;&quot;)</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &#39;//FULL SCREEN MOD</div><div class="code_line">&nbsp;&nbsp; Call dd.SetCooperativeLevel(Me.hWnd, DDSCL_FULLSCREEN Or DDSCL_ALLOWMODEX Or &nbsp; &nbsp; DDSCL_EXCLUSIVE)</div><div class="code_line">&nbsp;&nbsp; Call dd.SetDisplayMode(800, 600, 32, 0, DDSDM_DEFAULT) &#39;//DispWidth, DispHeight, Bits</div><div class="code_line">&nbsp;</div><div class="code_line">End Sub</div><div class="code_line">&nbsp;</div><div class="code_line">Private Sub Form_Unload(Cancel As Integer)</div><div class="code_line">&nbsp;&nbsp; Call dd.RestoreDisplayMode</div><div class="code_line">&nbsp;&nbsp; Call dd.SetCooperativeLevel(Me.hWnd, DDSCL_NORMAL)</div><div class="code_line">End Sub</div></ol></div></div></div></div><br>
<br>
<strong class='tag-b'>tnx for Slip</strong> <br>
Вариант 3<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">Option Explicit</div><div class="code_line">Const WM_DISPLAYCHANGE = &amp;H7E</div><div class="code_line">Const HWND_BROADCAST = &amp;HFFFF&amp;</div><div class="code_line">Const EWX_LOGOFF = 0</div><div class="code_line">Const EWX_SHUTDOWN = 1</div><div class="code_line">Const EWX_REBOOT = 2</div><div class="code_line">Const EWX_FORCE = 4</div><div class="code_line">Const CCDEVICENAME = 32</div><div class="code_line">Const CCFORMNAME = 32</div><div class="code_line">Const DM_BITSPERPEL = &amp;H40000</div><div class="code_line">Const DM_PELSWIDTH = &amp;H80000</div><div class="code_line">Const DM_PELSHEIGHT = &amp;H100000</div><div class="code_line">Const DM_DISPLAYFREQUENCY = &amp;H400000</div><div class="code_line">Const CDS_UPDATEREGISTRY = &amp;H1</div><div class="code_line">Const CDS_TEST = &amp;H4</div><div class="code_line">Const DISP_CHANGE_SUCCESSFUL = 0</div><div class="code_line">Const DISP_CHANGE_RESTART = 1</div><div class="code_line">Const BITSPIXEL = 12</div><div class="code_line">Public Type DEVMODE</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmDeviceName As String * CCDEVICENAME</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmSpecVersion As Integer</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmDriverVersion As Integer</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmSize As Integer</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmDriverExtra As Integer</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmFields As Long</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmOrientation As Integer</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmPaperSize As Integer</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmPaperLength As Integer</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmPaperWidth As Integer</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmScale As Integer</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmCopies As Integer</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmDefaultSource As Integer</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmPrintQuality As Integer</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmColor As Integer</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmDuplex As Integer</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmYResolution As Integer</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmTTOption As Integer</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmCollate As Integer</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmFormName As String * CCFORMNAME</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmUnusedPadding As Integer</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmBitsPerPel As Integer</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmPelsWidth As Long</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmPelsHeight As Long</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmDisplayFlags As Long</div><div class="code_line">&nbsp;&nbsp; &nbsp;dmDisplayFrequency As Long</div><div class="code_line">End Type</div><div class="code_line">Public Declare Function EnumDisplaySettings Lib &quot;user32&quot; Alias &quot;EnumDisplaySettingsA&quot; (ByVal lpszDeviceName As Long, ByVal iModeNum As Long, lpDevMode As Any) As Boolean</div><div class="code_line">Public Declare Function ChangeDisplaySettings Lib &quot;user32&quot; Alias &quot;ChangeDisplaySettingsA&quot; (lpDevMode As Any, ByVal dwFlags As Long) As Long</div><div class="code_line">Public Declare Function ExitWindowsEx Lib &quot;user32&quot; (ByVal uFlags As Long, ByVal dwReserved As Long) As Long</div><div class="code_line">Public Declare Function GetDeviceCaps Lib &quot;gdi32&quot; (ByVal hdc As Long, ByVal nIndex As Long) As Long</div><div class="code_line">Public Declare Function CreateDC Lib &quot;gdi32&quot; Alias &quot;CreateDCA&quot; (ByVal lpDriverName As String, ByVal lpDeviceName As String, ByVal lpOutput As String, ByVal lpInitData As Any) As Long</div><div class="code_line">Public Declare Function DeleteDC Lib &quot;gdi32&quot; (ByVal hdc As Long) As Long</div><div class="code_line">Public Declare Function SendMessage Lib &quot;user32&quot; Alias &quot;SendMessageA&quot; (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long</div><div class="code_line">Public OldX As Long, OldY As Long, nDC As Long</div><div class="code_line">&nbsp;</div><div class="code_line">Sub ChangeRes(X As Long, Y As Long, Bits As Long)</div><div class="code_line">&nbsp;&nbsp; &nbsp;Dim DevM As DEVMODE, ScInfo As Long, erg As Long, an As VbMsgBoxResult</div><div class="code_line">&nbsp;&nbsp; &nbsp;&#39;Get the info into DevM</div><div class="code_line">&nbsp;&nbsp; &nbsp;erg = EnumDisplaySettings(0&amp;, 0&amp;, DevM)</div><div class="code_line">&nbsp;&nbsp; &nbsp;&#39;This is what we&#39;re going to change</div><div class="code_line">&nbsp;&nbsp; &nbsp;DevM.dmFields = DM_PELSWIDTH Or DM_PELSHEIGHT Or DM_BITSPERPEL Or DM_DISPLAYFREQUENCY</div><div class="code_line">&nbsp;&nbsp; &nbsp;DevM.dmPelsWidth = 800 &#39;ScreenWidth</div><div class="code_line">&nbsp;&nbsp; &nbsp;DevM.dmPelsHeight = 600 &#39;ScreenHeight</div><div class="code_line">&nbsp;&nbsp; &nbsp;DevM.dmBitsPerPel = 32 &#39;(can be 8, 16, 24, 32 or even 4)</div><div class="code_line">&nbsp;&nbsp; &nbsp;DevM.dmDisplayFrequency = 85</div><div class="code_line">&nbsp;&nbsp; &nbsp;&#39;Now change the display and check if possible</div><div class="code_line">&nbsp;&nbsp; &nbsp;erg = ChangeDisplaySettings(DevM, CDS_TEST)</div><div class="code_line">&nbsp;&nbsp; &nbsp;&#39;Check if succesfull</div><div class="code_line">&nbsp;&nbsp; &nbsp;Select Case erg&amp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Case DISP_CHANGE_RESTART</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;an = MsgBox(&quot;You&#39;ve to reboot&quot;, vbYesNo + vbSystemModal, &quot;Info&quot;)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;If an = vbYes Then</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;erg&amp; = ExitWindowsEx(EWX_REBOOT, 0&amp;)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;End If</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Case DISP_CHANGE_SUCCESSFUL</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;erg = ChangeDisplaySettings(DevM, CDS_UPDATEREGISTRY)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ScInfo = Y * 2 ^ 16 + X</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#39;Notify all the windows of the screen resolution change</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SendMessage HWND_BROADCAST, WM_DISPLAYCHANGE, ByVal Bits, ByVal ScInfo</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;MsgBox &quot;Everything&#39;s ok&quot;, vbOKOnly + vbSystemModal, &quot;It worked!&quot;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Case Else</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;MsgBox &quot;Mode not supported&quot;, vbOKOnly + vbSystemModal, &quot;Error&quot;</div><div class="code_line">&nbsp;&nbsp; &nbsp;End Select</div><div class="code_line">End Sub</div></ol></div></div></div></div>]]></description>
        <author>Vasya2000</author>
        <category>Работа с Windows</category>
      </item>
	
      </channel>
      </rss>
	