home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
MediaPortal 1 Talk
Two Questions: Standby & Monitor Off when idle
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="cheetah05" data-source="post: 160514" data-attributes="member: 19628"><p>Just to let you know, I managed to fix this without using any extra wires.</p><p></p><p>I created a small program which changes the resolution to something small and then changes it back to the default resolution when the computer comes out of standby.</p><p></p><p>Thanks for your help though.</p><p></p><p>For anyone that wants the code:</p><p></p><p>[code]</p><p>#Region "Imports"</p><p></p><p>Imports Microsoft.Win32</p><p></p><p>#End Region</p><p></p><p>Public Class mainForm</p><p></p><p>#Region "Change Resolution Function"</p><p></p><p> Const CCDEVICENAME As Short = 32</p><p> Const CCFORMNAME As Short = 32</p><p> Const DM_BITSPERPEL As Integer = &H40000</p><p> Const DM_PELSWIDTH As Integer = &H80000</p><p> Const DM_PELSHEIGHT As Integer = &H100000</p><p> Const CDS_UPDATEREGISTRY As Short = &H1S</p><p> Const CDS_TEST As Short = &H4S</p><p> Const DISP_CHANGE_SUCCESSFUL As Short = 0</p><p> Const DISP_CHANGE_RESTART As Short = 1</p><p> Const BITSPIXEL As Short = 12</p><p></p><p> Private Structure DEVMODE</p><p> <VBFixedString(CCDEVICENAME), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=CCDEVICENAME)> Public dmDeviceName As String</p><p> Dim dmSpecVersion As Short</p><p> Dim dmDriverVersion As Short</p><p> Dim dmSize As Short</p><p> Dim dmDriverExtra As Short</p><p> Dim dmFields As Integer</p><p> Dim dmOrientation As Short</p><p> Dim dmPaperSize As Short</p><p> Dim dmPaperLength As Short</p><p> Dim dmPaperWidth As Short</p><p> Dim dmScale As Short</p><p> Dim dmCopies As Short</p><p> Dim dmDefaultSource As Short</p><p> Dim dmPrintQuality As Short</p><p> Dim dmColor As Short</p><p> Dim dmDuplex As Short</p><p> Dim dmYResolution As Short</p><p> Dim dmTTOption As Short</p><p> Dim dmCollate As Short</p><p> <VBFixedString(CCFORMNAME), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=CCFORMNAME)> Public dmFormName As String</p><p> Dim dmUnusedPadding As Short</p><p> Dim dmBitsPerPel As Short</p><p> Dim dmPelsWidth As Integer</p><p> Dim dmPelsHeight As Integer</p><p> Dim dmDisplayFlags As Integer</p><p> Dim dmDisplayFrequency As Integer</p><p> End Structure</p><p></p><p> Private Declare Function EnumDisplaySettings Lib "user32" Alias "EnumDisplaySettingsA" (ByVal lpszDeviceName As Integer, ByVal iModeNum As Integer, ByRef lpDevMode As DEVMODE) As Boolean</p><p> Private Declare Function ChangeDisplaySettings Lib "user32" Alias "ChangeDisplaySettingsA" (ByRef lpDevMode As DEVMODE, ByVal dwFlags As Integer) As Integer</p><p></p><p> Private Sub ChangeRes(ByRef X As Integer, ByRef Y As Integer, ByRef Bits As Integer)</p><p> Dim DevM As DEVMODE = Nothing</p><p> Dim erg As Integer</p><p> 'Get the info into DevM</p><p> erg = EnumDisplaySettings(0, 0, DevM)</p><p> 'This is what we're going to change</p><p> DevM.dmFields = DM_PELSWIDTH Or DM_PELSHEIGHT Or DM_BITSPERPEL</p><p> DevM.dmPelsWidth = X 'ScreenWidth</p><p> DevM.dmPelsHeight = Y 'ScreenHeight</p><p> DevM.dmBitsPerPel = Bits '(can be 8, 16, 24, 32 or even 4)</p><p> 'Now change the display and check if possible</p><p> erg = ChangeDisplaySettings(DevM, CDS_TEST)</p><p> End Sub</p><p></p><p>#End Region</p><p></p><p>#Region "Declarations"</p><p></p><p> Dim WithEvents systemEvent As SystemEvents</p><p></p><p>#End Region</p><p></p><p> Private Sub On_Standby_Resume(ByVal sender As Object, ByVal e As Microsoft.Win32.PowerModeChangedEventArgs) Handles systemEvent.PowerModeChanged</p><p></p><p> If e.Mode = PowerModes.Resume Then</p><p></p><p> ChangeRes(1280, 768, 32)</p><p> ChangeRes(1360, 768, 32)</p><p></p><p> End If</p><p></p><p> End Sub</p><p></p><p>End Class</p><p>[/code]</p></blockquote><p></p>
[QUOTE="cheetah05, post: 160514, member: 19628"] Just to let you know, I managed to fix this without using any extra wires. I created a small program which changes the resolution to something small and then changes it back to the default resolution when the computer comes out of standby. Thanks for your help though. For anyone that wants the code: [code] #Region "Imports" Imports Microsoft.Win32 #End Region Public Class mainForm #Region "Change Resolution Function" Const CCDEVICENAME As Short = 32 Const CCFORMNAME As Short = 32 Const DM_BITSPERPEL As Integer = &H40000 Const DM_PELSWIDTH As Integer = &H80000 Const DM_PELSHEIGHT As Integer = &H100000 Const CDS_UPDATEREGISTRY As Short = &H1S Const CDS_TEST As Short = &H4S Const DISP_CHANGE_SUCCESSFUL As Short = 0 Const DISP_CHANGE_RESTART As Short = 1 Const BITSPIXEL As Short = 12 Private Structure DEVMODE <VBFixedString(CCDEVICENAME), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=CCDEVICENAME)> Public dmDeviceName As String Dim dmSpecVersion As Short Dim dmDriverVersion As Short Dim dmSize As Short Dim dmDriverExtra As Short Dim dmFields As Integer Dim dmOrientation As Short Dim dmPaperSize As Short Dim dmPaperLength As Short Dim dmPaperWidth As Short Dim dmScale As Short Dim dmCopies As Short Dim dmDefaultSource As Short Dim dmPrintQuality As Short Dim dmColor As Short Dim dmDuplex As Short Dim dmYResolution As Short Dim dmTTOption As Short Dim dmCollate As Short <VBFixedString(CCFORMNAME), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst:=CCFORMNAME)> Public dmFormName As String Dim dmUnusedPadding As Short Dim dmBitsPerPel As Short Dim dmPelsWidth As Integer Dim dmPelsHeight As Integer Dim dmDisplayFlags As Integer Dim dmDisplayFrequency As Integer End Structure Private Declare Function EnumDisplaySettings Lib "user32" Alias "EnumDisplaySettingsA" (ByVal lpszDeviceName As Integer, ByVal iModeNum As Integer, ByRef lpDevMode As DEVMODE) As Boolean Private Declare Function ChangeDisplaySettings Lib "user32" Alias "ChangeDisplaySettingsA" (ByRef lpDevMode As DEVMODE, ByVal dwFlags As Integer) As Integer Private Sub ChangeRes(ByRef X As Integer, ByRef Y As Integer, ByRef Bits As Integer) Dim DevM As DEVMODE = Nothing Dim erg As Integer 'Get the info into DevM erg = EnumDisplaySettings(0, 0, DevM) 'This is what we're going to change DevM.dmFields = DM_PELSWIDTH Or DM_PELSHEIGHT Or DM_BITSPERPEL DevM.dmPelsWidth = X 'ScreenWidth DevM.dmPelsHeight = Y 'ScreenHeight DevM.dmBitsPerPel = Bits '(can be 8, 16, 24, 32 or even 4) 'Now change the display and check if possible erg = ChangeDisplaySettings(DevM, CDS_TEST) End Sub #End Region #Region "Declarations" Dim WithEvents systemEvent As SystemEvents #End Region Private Sub On_Standby_Resume(ByVal sender As Object, ByVal e As Microsoft.Win32.PowerModeChangedEventArgs) Handles systemEvent.PowerModeChanged If e.Mode = PowerModes.Resume Then ChangeRes(1280, 768, 32) ChangeRes(1360, 768, 32) End If End Sub End Class [/code] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
MediaPortal 1 Talk
Two Questions: Standby & Monitor Off when idle
Contact us
RSS
Top
Bottom