You are correct. I had a typo in the problem statement that I've updated. What happens is: [2nd Monitor (extended desktop)][Laptop] ...Hibernate... ...Resume... [Laptop][2nd Monitor(extended desktop)] And I'm trying to read the fact that the 2nd monitor is on the left, and then set those same settings later. Can you help?? :)
vbnetnoowb
Posts
-
Retrieving and restoring extended desktop settings with EnumDisplaySettingsEx [modified] -
unknown problem. please help.To make the labels and textboxes you can use a for loop that dynamically creates them based on user input. For the db connectivity, what exactly are you looking for?
-
Retrieving and restoring extended desktop settings with EnumDisplaySettingsEx [modified]Hi all. I've been trying in vein for days to figure this out. I use extended desktop to extend my display to the left, not the right, and when I hibernate and come back, the desktop is extended to the right. So I'm writing an app that will retrieve the extended desktop settings on hibernate and set them again on resume. I've seen a few examples of using EnumDisplaySettingsEx in C and C#, but nothing in vb.net that helps. I just need to figure out how to determine "This monitor is primary, that one is secondary and is positioned on the left." And then "Set this monitor to primary, set that one to be on the left." I already have the rest of the app written (detecting hibernate, etc.), but I'm super new to the Windows API and all these structs and translations from C to vb.net are way out of my league. I'm desperate :doh:. Help! ---- P.S. I've pieced together the following, and it gets devicename and resolution successfully, but I'm still stuck on the aforementioned stuff: Imports System.Runtime.InteropServices Public Class Form1 Inherits System.Windows.Forms.Form Const ENUM_CURRENT_SETTINGS As Integer = -1 Const CDS_UPDATEREGISTRY As Integer = &H1 Const CDS_TEST As Long = &H2 Const CCDEVICENAME As Integer = 32 Const CCFORMNAME As Integer = 32 Const DISP_CHANGE_SUCCESSFUL As Integer = 0 Const DISP_CHANGE_RESTART As Integer = 1 Const DISP_CHANGE_FAILED As Integer = -1 Private Declare Function EnumDisplaySettingsEx Lib "user32" Alias "EnumDisplaySettingsExA" (ByVal lpszDeviceName As Integer, ByVal iModeNum As Integer, ByRef lpDevMode As DEVMODE, ByVal dwFlags As Integer) As Integer Private Declare Function ChangeDisplaySettings Lib "user32" Alias "ChangeDisplaySettingsA" (ByRef DEVMODE As DEVMODE, ByVal flags As Long) As Integer Public Structure DEVMODE _ Public dmDeviceName As String Public dmSpecVersion As Short Public dmDriverVersion As Short Public dmSize As Short Public dmDriverExtra As Short Public dmFields As Integer Public dmOrientation As Short Public dmPaperSize As Short Public dmPaperLength As Short Public dmPaperWidth As Short Public dmScale As Short Public dmCopies As Short Public dmDefaultSource As Short Public dmPrintQuality As Short Public dmColor As Short