Ein bisschen verfeinert.
Nicht erschrecken, wenn man den X-Button wegen leichter Verwirrung nicht mehr erreichen kann, einfach ALT+F4 drücken
Code: Alles auswählen
; DEVMODE is still included
;
Enumeration
#DMDO_DEFAULT ; The display orientation is the natural orientation of the display device; it should be used as the default.
#DMDO_90 ; The display orientation is rotated 90 degrees (measured clockwise) from DMDO_DEFAULT.
#DMDO_180 ; The display orientation is rotated 180 degrees (measured clockwise) from DMDO_DEFAULT.
#DMDO_270 ; The display orientation is rotated 270 degrees (measured clockwise) from DMDO_DEFAULT.
EndEnumeration
#DISP_CHANGE_SUCCESSFUL = 0
#DISP_CHANGE_RESTART = 1
#DISP_CHANGE_FAILED = -1
#DISP_CHANGE_BADMODE = -2
#DISP_CHANGE_NOTUPDATED = -3
#DISP_CHANGE_BADFLAGS = -4
#DISP_CHANGE_BADPARAM = -5
#DISP_CHANGE_BADDUALVIEW = -6
Procedure main()
Protected devmode.DEVMODE, devmodeC.DEVMODE
Protected result.l, n, Dev$, Orig_Orientation, DesktopName$
If OpenWindow(1, 0, 0, 400, 400, "INFO", #PB_Window_WindowCentered | #PB_Window_SystemMenu)
ListViewGadget(1, 10, 10, 380, 380)
Count = ExamineDesktops()
For n = 0 To Count - 1
Dev$ = DesktopName(n)
If EnumDisplaySettings_(@Dev$, #ENUM_CURRENT_SETTINGS, @devmode) > 0
AddGadgetItem(1, - 1, "Display = " + #DQUOTE$ + Dev$ + #DQUOTE$)
If n = 0
;copy main desktop settings for some fun
CopyStructure(@devmode, @devmodeC, DEVMODE)
AddGadgetItem(1, - 1, " Primary Monitor")
Orig_Orientation = devmode\Display\dmDisplayOrientation
DesktopName$ = Dev$
EndIf
AddGadgetItem(1, - 1, " Frequency = " + Str(devmode\dmDisplayFrequency))
AddGadgetItem(1, - 1, " BitsPerPel = " + Str(devmode\dmBitsPerPel))
AddGadgetItem(1, - 1, " PelsWidth = " + Str(devmode\dmPelsWidth))
AddGadgetItem(1, - 1, " PelsHeight = " + Str(devmode\dmPelsHeight))
AddGadgetItem(1, - 1, " DO = " + StringField("DEFAULT 90 180 270", 1 + devmode\Display\dmDisplayOrientation, " ") + " (" + Str(devmode\Display\dmDisplayOrientation) + ")")
AddGadgetItem(1, - 1, "")
EndIf
Next n
;just for fun, swap main monitor 90°
devmodeC\Display\dmDisplayOrientation = #DMDO_90
Swap devmodeC\dmPelsHeight, devmodeC\dmPelsWidth
result = ChangeDisplaySettingsEx_(@DesktopName$, @devmodeC, 0, 0, 0)
Select result
Case #DISP_CHANGE_SUCCESSFUL
Debug "The settings change was successful."
Case #DISP_CHANGE_BADDUALVIEW
Debug "The settings change was unsuccessful because the system is DualView capable."
Case #DISP_CHANGE_BADFLAGS
Debug "An invalid set of flags was passed in."
Case #DISP_CHANGE_BADMODE
Debug "The graphics mode is Not supported."
Case #DISP_CHANGE_BADPARAM
Debug "An invalid parameter was passed in. This can include an invalid flag Or combination of flags."
Case #DISP_CHANGE_FAILED
Debug "The display driver failed the specified graphics mode."
Case #DISP_CHANGE_NOTUPDATED
Debug "Unable To write settings To the registry."
Case #DISP_CHANGE_RESTART
Debug "The computer must be restarted For the graphics mode To work."
EndSelect
While WaitWindowEvent() <> #PB_Event_CloseWindow : Wend
devmodeC\Display\dmDisplayOrientation = Orig_Orientation
Swap devmodeC\dmPelsHeight, devmodeC\dmPelsWidth
ChangeDisplaySettingsEx_(@DesktopName$, @devmodeC, 0, 0, 0)
EndIf
ProcedureReturn 0
EndProcedure
main()
Irgendwie fallen mir da lustige Sachen ein, um Kollegen zu ärgern...
Wobei ich das Problem nicht wirklich vestanden habe.
Ich habe hier einen Laptop mit drei Monitoren.
Würde ich einen hochkant nutzen, würde ich das Windows einmalig sagen und es merkt sich das.
Ich kann den Laptop auch aufklappen, dann habe ich 4 Monitore und wieder zu, dann wieder drei und die Orientierungen stimmen trotzdem?