Jump to content

Rotate display by 270 degrees


Recommended Posts

Hiho Forum,

I'm looking for a way to rotate the display by 270 degrees. I know my screen supports that (CTRL+ALT+{Arrow Right} works fine). The attached script rotates the display by 90 degrees only. Has anyone come accross this issue?

When running the attached script, either run it a second time or press CTRL+ALT+{Arrow Up} to reset the orientation to default.

$h_DLL_user32 = DllOpen("user32.dll")
Global Const $DMDO_DEFAULT = 0
Global Const $DMDO_90 = 1
Global Const $DMDO_180 = 2
Global Const $DMDO_270 = 3
Global Const $_tag_DEVMODE = "CHAR dmDeviceName[32];WORD dmSpecVersion;WORD dmDriverVersion;" & _
  "WORD dmSize;WORD dmDriverExtra;DWORD dmFields;LONG dmPositionx;LONG dmPositiony;DWORD dmDisplayOrientation;DWORD dmDisplayFixedOutput;" & _
  "short dmColor;short dmDuplex;short dmYResolution;short dmTTOption;short dmCollate;" & _
  "CHAR dmFormName[32];WORD dmLogPixels;DWORD dmBitsPerPel;DWORD dmPelsWidth;DWORD dmPelsHeight;" & _
  "DWORD dmDisplayFlags;DWORD dmDisplayFrequency;"
$DEVMODE = DllStructCreate($_tag_DEVMODE)
DllStructSetData($DEVMODE, "dmSize", DllStructGetSize($DEVMODE))
Global Const $ENUM_CURRENT_SETTINGS = -1
Global Const $ENUM_REGISTRY_SETTINGS = -2
Local $B = DllCall($h_DLL_user32, "int", "EnumDisplaySettingsEx", "ptr", 0, "dword", $ENUM_CURRENT_SETTINGS, "ptr", DllStructGetPtr($DEVMODE), "dword", BitOR(0x00000002, 0x00000004))
ConsoleWrite(DllStructGetData($DEVMODE, "dmSize") & @CRLF)
ConsoleWrite(DllStructGetData($DEVMODE, "dmDriverExtra") & @CRLF)
ConsoleWrite(DllStructGetData($DEVMODE, "dmPelsWidth") & @CRLF)
ConsoleWrite(DllStructGetData($DEVMODE, "dmPelsHeight") & @CRLF)
ConsoleWrite(DllStructGetData($DEVMODE, "dmDisplayOrientation") & @CRLF & @CRLF)
Local Const $DM_PELSWIDTH = 0x00080000
Local Const $DM_PELSHEIGHT = 0x00100000
Local Const $DM_DISPLAYORIENTATION = 0x00800000
Local Const $DM_BITSPERPEL = 0x00040000
Local Const $DM_DISPLAYFREQUENCY = 0x00400000

DllStructSetData($DEVMODE, "dmFields", BitOR($DM_PELSWIDTH, $DM_PELSHEIGHT, $DM_DISPLAYORIENTATION))
DllStructSetData($DEVMODE, "dmDisplayOrientation", $DMDO_270)
Local $stmp = DllStructGetData($DEVMODE, "dmPelsWidth")
DllStructSetData($DEVMODE, "dmPelsWidth", DllStructGetData($DEVMODE, "dmPelsHeight"))
DllStructSetData($DEVMODE, "dmPelsHeight", $stmp)
Local Const $CDS_TEST = 0x00000002
Local Const $CDS_UPDATEREGISTRY = 0x00000001
Local Const $CDS_RESET = 0x40000000
Local Const $CDS_ENABLE_UNSAFE_MODES = 0x00000100
ConsoleWrite(DllStructGetData($DEVMODE, "dmPelsWidth") & @CRLF)
ConsoleWrite(DllStructGetData($DEVMODE, "dmPelsHeight") & @CRLF)
ConsoleWrite(DllStructGetData($DEVMODE, "dmDisplayOrientation") & @CRLF & @CRLF)
$B = DllCall($h_DLL_user32, "int", "ChangeDisplaySettingsEx", "ptr", 0, "ptr", DllStructGetPtr($DEVMODE), "hwnd", 0, "int", BitOR($CDS_RESET, $CDS_UPDATEREGISTRY), "ptr", 0)
ConsoleWrite($B[0] & @TAB & @error & @CRLF)
Local Const $HWND_BROADCAST = 0xffff
Local Const $WM_DISPLAYCHANGE = 0x007E
$i_BitsPP = DllStructGetData($DEVMODE, "dmBitsPerPel")
$i_Width = DllStructGetData($DEVMODE, "dmPelsWidth")
$i_Height = DllStructGetData($DEVMODE, "dmPelsHeight")
DllCall($h_DLL_user32, "int", "SendMessage", "hwnd", $HWND_BROADCAST, "int", $WM_DISPLAYCHANGE, "int", $i_BitsPP, "int", $i_Height * 2 ^ 16 + $i_Width)

Best Regards

Link to comment
Share on other sites

Here your script doesn't do anything.

I have two Acer B243HL displays and when I press Ctrl-Alt-arrow it changes the orientation of the screen where the cursor is located.

Your consolewrites (I added the name of the variable) gives the following result:

dmSize 124
dmDriverExtra 0
dmPelsWidth 1920
dmPelsHeight 1080
dmDisplayOrientation 0
dmPelsWidth 1080
dmPelsHeight 1920
dmDisplayOrientation 3
After ChangeDisplaySettingsEx -2 0

My environment:

+>11:05:11 Starting AutoIt3Wrapper v.2.1.0.8    Environment(Language:0407  Keyboard:00000407  OS:WIN_7/Service Pack 1  CPU:X64 OS:X64)
>Running:(3.3.8.0)
Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Link to comment
Share on other sites

I think I found it :oops:. The old data in the dmFields element must not be delete. This line fixes that:

DllStructSetData($DEVMODE, "dmFields", BitOR(DllStructGetData($DEVMODE, "dmFields"), $DM_DISPLAYORIENTATION))

$h_DLL_user32 = DllOpen("user32.dll")
Global Const $DMDO_DEFAULT = 0
Global Const $DMDO_90 = 1
Global Const $DMDO_180 = 2
Global Const $DMDO_270 = 3
Global Const $_tag_DEVMODE = "CHAR dmDeviceName[32];WORD dmSpecVersion;WORD dmDriverVersion;" & _
  "WORD dmSize;WORD dmDriverExtra;DWORD dmFields;LONG dmPositionx;LONG dmPositiony;DWORD dmDisplayOrientation;DWORD dmDisplayFixedOutput;" & _
  "short dmColor;short dmDuplex;short dmYResolution;short dmTTOption;short dmCollate;" & _
  "CHAR dmFormName[32];WORD dmLogPixels;DWORD dmBitsPerPel;DWORD dmPelsWidth;DWORD dmPelsHeight;" & _
  "DWORD dmDisplayFlags;DWORD dmDisplayFrequency;"
$DEVMODE = DllStructCreate($_tag_DEVMODE)
DllStructSetData($DEVMODE, "dmSize", DllStructGetSize($DEVMODE))
Global Const $ENUM_CURRENT_SETTINGS = -1
Global Const $ENUM_REGISTRY_SETTINGS = -2
Local $B = DllCall($h_DLL_user32, "int", "EnumDisplaySettingsEx", "ptr", 0, "dword", $ENUM_CURRENT_SETTINGS, "ptr", DllStructGetPtr($DEVMODE), "dword", BitOR(0x00000002, 0x00000004))
ConsoleWrite(DllStructGetData($DEVMODE, "dmSize") & @CRLF)
ConsoleWrite(DllStructGetData($DEVMODE, "dmDriverExtra") & @CRLF)
ConsoleWrite(DllStructGetData($DEVMODE, "dmPelsWidth") & @CRLF)
ConsoleWrite(DllStructGetData($DEVMODE, "dmPelsHeight") & @CRLF)
ConsoleWrite(DllStructGetData($DEVMODE, "dmDisplayOrientation") & @CRLF & @CRLF)
Local Const $DM_PELSWIDTH = 0x00080000
Local Const $DM_PELSHEIGHT = 0x00100000
Local Const $DM_DISPLAYQUERYORIENTATION = 0x01000000
Local Const $DM_DISPLAYORIENTATION = 0x00800000
Local Const $DM_BITSPERPEL = 0x00040000
Local Const $DM_DISPLAYFREQUENCY = 0x00400000
DllStructSetData($DEVMODE, "dmFields", BitOR(DllStructGetData($DEVMODE, "dmFields"), $DM_DISPLAYORIENTATION))
Local $iOrientation = $DMDO_270
DllStructSetData($DEVMODE, "dmDisplayOrientation", $iOrientation)
If $iOrientation = $DMDO_90 Or $iOrientation = $DMDO_270 Then ; swap width & height
 Local $stmp = DllStructGetData($DEVMODE, "dmPelsWidth")
 DllStructSetData($DEVMODE, "dmPelsWidth", DllStructGetData($DEVMODE, "dmPelsHeight"))
 DllStructSetData($DEVMODE, "dmPelsHeight", $stmp)
EndIf
Local Const $CDS_TEST = 0x00000002
Local Const $CDS_UPDATEREGISTRY = 0x00000001
Local Const $CDS_RESET = 0x40000000
Local Const $CDS_ENABLE_UNSAFE_MODES = 0x00000100
ConsoleWrite(DllStructGetData($DEVMODE, "dmPelsWidth") & @CRLF)
ConsoleWrite(DllStructGetData($DEVMODE, "dmPelsHeight") & @CRLF)
ConsoleWrite(DllStructGetData($DEVMODE, "dmDisplayOrientation") & @CRLF & @CRLF)
$B = DllCall($h_DLL_user32, "int", "ChangeDisplaySettingsEx", "ptr", 0, "ptr", DllStructGetPtr($DEVMODE), "hwnd", 0, "int", $CDS_UPDATEREGISTRY, "ptr", 0)
ConsoleWrite($B[0] & @TAB & @error & @CRLF)
Local Const $HWND_BROADCAST = 0xffff
Local Const $WM_DISPLAYCHANGE = 0x007E
$i_BitsPP = DllStructGetData($DEVMODE, "dmBitsPerPel")
$i_Width = DllStructGetData($DEVMODE, "dmPelsWidth")
$i_Height = DllStructGetData($DEVMODE, "dmPelsHeight")
DllCall($h_DLL_user32, "int", "SendMessage", "hwnd", $HWND_BROADCAST, "int", $WM_DISPLAYCHANGE, "int", $i_BitsPP, "int", $i_Height * 2 ^ 16 + $i_Width)
Link to comment
Share on other sites

It's working here too now! At least for screen 1.

Just as an info: Ctrl-Alt-arrow seems to change the orientation of the screen where the cursor is currently located.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Perfect, thanks a lot for testing :oops:. Yeah, at this stage it only changes the orientation on the primary display, for other display the lpszDeviceName in the ChangeDisplaySettingsEx function needs to be set accordingly. I guess the hotkey does this automatically.

Link to comment
Share on other sites

  • 3 weeks later...

Hello. I'm very sorry to resurrect this thread, but I couldn't really find anything anywhere else.

So I run this script and it works flawlessly; it does exactly what I need it to do. However when I run it again it does not reset back to the orientation which it was in before the first run.

Is there a way to make this script basically a "toggle" of sorts? Run it once and it flips; run it again and it flips back? Currently I have to go into the nVidia settings each time to set it back which is kind of a hassle (which is why I was looking for an AutoIt script like this in the fist place xD).

Any help is appreciated. Thanks.

TheMusiKid

Link to comment
Share on other sites

I wouldn't consider posting to a three weeks old thread a resurrection :oops:...

Global Const $HWND_BROADCAST = 0xffff
Global Const $WM_DISPLAYCHANGE = 0x007E
Global Const $SMTO_ABORTIFHUNG = 0x0002
Global Const $MSG_TIMEOUT = 500
Global $h_DLL_user32 = DllOpen("user32.dll")
Global Const $DMDO_DEFAULT = 0
Global Const $DMDO_90 = 1
Global Const $DMDO_180 = 2
Global Const $DMDO_270 = 3
Global Const $_tag_DEVMODE = "CHAR dmDeviceName[32];WORD dmSpecVersion;WORD dmDriverVersion;" & _
  "WORD dmSize;WORD dmDriverExtra;DWORD dmFields;LONG dmPositionx;LONG dmPositiony;DWORD dmDisplayOrientation;DWORD dmDisplayFixedOutput;" & _
  "short dmColor;short dmDuplex;short dmYResolution;short dmTTOption;short dmCollate;" & _
  "CHAR dmFormName[32];WORD dmLogPixels;DWORD dmBitsPerPel;DWORD dmPelsWidth;DWORD dmPelsHeight;" & _
  "DWORD dmDisplayFlags;DWORD dmDisplayFrequency;"
$DEVMODE = DllStructCreate($_tag_DEVMODE)
DllStructSetData($DEVMODE, "dmSize", DllStructGetSize($DEVMODE))
Global Const $ENUM_CURRENT_SETTINGS = -1
Global Const $ENUM_REGISTRY_SETTINGS = -2
Local $B = DllCall($h_DLL_user32, "int", "EnumDisplaySettingsEx", "ptr", 0, "dword", $ENUM_CURRENT_SETTINGS, "ptr", DllStructGetPtr($DEVMODE), "dword", BitOR(0x00000002, 0x00000004))
ConsoleWrite(DllStructGetData($DEVMODE, "dmSize") & @CRLF)
ConsoleWrite(DllStructGetData($DEVMODE, "dmDriverExtra") & @CRLF)
ConsoleWrite(DllStructGetData($DEVMODE, "dmPelsWidth") & @CRLF)
ConsoleWrite(DllStructGetData($DEVMODE, "dmPelsHeight") & @CRLF)
ConsoleWrite(DllStructGetData($DEVMODE, "dmDisplayOrientation") & @CRLF & @CRLF)
Local Const $DM_PELSWIDTH = 0x00080000
Local Const $DM_PELSHEIGHT = 0x00100000
Local Const $DM_DISPLAYQUERYORIENTATION = 0x01000000
Local Const $DM_DISPLAYORIENTATION = 0x00800000
Local Const $DM_BITSPERPEL = 0x00040000
Local Const $DM_DISPLAYFREQUENCY = 0x00400000
DllStructSetData($DEVMODE, "dmFields", BitOR(DllStructGetData($DEVMODE, "dmFields"), $DM_DISPLAYORIENTATION))
Local $iOrientation_New = $DMDO_270
Local $iOrientation_Current = DllStructGetData($DEVMODE, "dmDisplayOrientation")
If $iOrientation_Current <> $DMDO_DEFAULT Then
 DllStructSetData($DEVMODE, "dmDisplayOrientation", $DMDO_DEFAULT)
Else
 DllStructSetData($DEVMODE, "dmDisplayOrientation", $iOrientation_New)
EndIf
Local $stmp = DllStructGetData($DEVMODE, "dmPelsWidth") ;  ; swap width & height
DllStructSetData($DEVMODE, "dmPelsWidth", DllStructGetData($DEVMODE, "dmPelsHeight"))
DllStructSetData($DEVMODE, "dmPelsHeight", $stmp)
Local Const $CDS_TEST = 0x00000002
Local Const $CDS_UPDATEREGISTRY = 0x00000001
Local Const $CDS_RESET = 0x40000000
Local Const $CDS_ENABLE_UNSAFE_MODES = 0x00000100
ConsoleWrite(DllStructGetData($DEVMODE, "dmPelsWidth") & @CRLF)
ConsoleWrite(DllStructGetData($DEVMODE, "dmPelsHeight") & @CRLF)
ConsoleWrite(DllStructGetData($DEVMODE, "dmDisplayOrientation") & @CRLF & @CRLF)
$B = DllCall($h_DLL_user32, "int", "ChangeDisplaySettingsEx", "ptr", 0, "ptr", DllStructGetPtr($DEVMODE), "hwnd", 0, "int", $CDS_UPDATEREGISTRY, "ptr", 0)
ConsoleWrite($B[0] & @TAB & @error & @CRLF)
$i_BitsPP = DllStructGetData($DEVMODE, "dmBitsPerPel")
$i_Width = DllStructGetData($DEVMODE, "dmPelsWidth")
$i_Height = DllStructGetData($DEVMODE, "dmPelsHeight")
_SendMessageTimeout_Ex($HWND_BROADCAST, $WM_DISPLAYCHANGE, $i_BitsPP, $i_Height * 2 ^ 16 + $i_Width)
Func _SendMessageTimeout_Ex($hWnd, $iMsg, $wParam = 0, $lParam = 0)
 Local $iRet = DllCall($h_DLL_user32, "lresult", "SendMessageTimeout", _
   "hwnd", $hWnd, _
   "uint", $iMsg, _
   "wparam", $wParam, _
   "lParam", $lParam, _
   "uint", $SMTO_ABORTIFHUNG, _
   "uint", $MSG_TIMEOUT, _
   "dword_ptr*", 0)
 Return $iRet[7]
EndFunc   ;==>_SendMessageTimeout_Ex
Link to comment
Share on other sites

I wouldn't consider posting to a three weeks old thread a resurrection Posted Image...

Well that's a relief.

Also thank you! :oops:.

Much appreciated. Saved me a bunches of troubles (my grammar is fine; say nothing).

EDIT: Unfortunately this only works when rotating 90 and 270 degrees, not 180 which is what I need (of course).

I know the thread is about 270 so I'm sorry to veer off to 180. It will switch to 90/270 and back just as it should, but it does nothing if $iOrientation_New is set to $DMDO_180.

Since it will only flip when the script is run, I could have it create a "boolean" file (if file exists, true; else false, etc.) and check that when it is run, but I don't really even understand how this script works completely to know where this check would go xD.

Edited by TheMusiKid
Link to comment
Share on other sites

Set the var $iOrientation_New according to your needs.

Global Const $DMDO_DEFAULT = 0
Global Const $DMDO_90 = 1
Global Const $DMDO_180 = 2
Global Const $DMDO_270 = 3
Global $iOrientation_New = $DMDO_180
Global Const $HWND_BROADCAST = 0xffff
Global Const $WM_DISPLAYCHANGE = 0x007E
Global Const $SMTO_ABORTIFHUNG = 0x0002
Global Const $MSG_TIMEOUT = 500
Global $h_DLL_user32 = DllOpen("user32.dll")
Global Const $_tag_DEVMODE = "CHAR dmDeviceName[32];WORD dmSpecVersion;WORD dmDriverVersion;" & _
  "WORD dmSize;WORD dmDriverExtra;DWORD dmFields;LONG dmPositionx;LONG dmPositiony;DWORD dmDisplayOrientation;DWORD dmDisplayFixedOutput;" & _
  "short dmColor;short dmDuplex;short dmYResolution;short dmTTOption;short dmCollate;" & _
  "CHAR dmFormName[32];WORD dmLogPixels;DWORD dmBitsPerPel;DWORD dmPelsWidth;DWORD dmPelsHeight;" & _
  "DWORD dmDisplayFlags;DWORD dmDisplayFrequency;"
$DEVMODE = DllStructCreate($_tag_DEVMODE)
DllStructSetData($DEVMODE, "dmSize", DllStructGetSize($DEVMODE))
Global Const $ENUM_CURRENT_SETTINGS = -1
Global Const $ENUM_REGISTRY_SETTINGS = -2
Local $B = DllCall($h_DLL_user32, "int", "EnumDisplaySettingsEx", "ptr", 0, "dword", $ENUM_CURRENT_SETTINGS, "ptr", DllStructGetPtr($DEVMODE), "dword", BitOR(0x00000002, 0x00000004))
ConsoleWrite(DllStructGetData($DEVMODE, "dmSize") & @CRLF)
ConsoleWrite(DllStructGetData($DEVMODE, "dmDriverExtra") & @CRLF)
ConsoleWrite(DllStructGetData($DEVMODE, "dmPelsWidth") & @CRLF)
ConsoleWrite(DllStructGetData($DEVMODE, "dmPelsHeight") & @CRLF)
ConsoleWrite(DllStructGetData($DEVMODE, "dmDisplayOrientation") & @CRLF & @CRLF)
Local Const $DM_PELSWIDTH = 0x00080000
Local Const $DM_PELSHEIGHT = 0x00100000
Local Const $DM_DISPLAYQUERYORIENTATION = 0x01000000
Local Const $DM_DISPLAYORIENTATION = 0x00800000
Local Const $DM_BITSPERPEL = 0x00040000
Local Const $DM_DISPLAYFREQUENCY = 0x00400000
DllStructSetData($DEVMODE, "dmFields", BitOR(DllStructGetData($DEVMODE, "dmFields"), $DM_DISPLAYORIENTATION))
Global $iOrientation_Current = DllStructGetData($DEVMODE, "dmDisplayOrientation")
If $iOrientation_Current = $iOrientation_New Then $iOrientation_New = $DMDO_DEFAULT
Global $bSwap
Switch $iOrientation_Current
 Case $DMDO_DEFAULT, $DMDO_180
  Switch $iOrientation_New
   Case $DMDO_90, $DMDO_270
    $bSwap = True
   Case Else
    $bSwap = False
  EndSwitch
 Case Else
  Switch $iOrientation_New
   Case $DMDO_DEFAULT, $DMDO_180
    $bSwap = True
   Case Else
    $bSwap = False
  EndSwitch
EndSwitch
DllStructSetData($DEVMODE, "dmDisplayOrientation", $iOrientation_New)
If $bSwap Then
 Global $stmp = DllStructGetData($DEVMODE, "dmPelsWidth") ;  ; swap width & height
 DllStructSetData($DEVMODE, "dmPelsWidth", DllStructGetData($DEVMODE, "dmPelsHeight"))
 DllStructSetData($DEVMODE, "dmPelsHeight", $stmp)
EndIf
Local Const $CDS_TEST = 0x00000002
Local Const $CDS_UPDATEREGISTRY = 0x00000001
Local Const $CDS_RESET = 0x40000000
Local Const $CDS_ENABLE_UNSAFE_MODES = 0x00000100
ConsoleWrite(DllStructGetData($DEVMODE, "dmPelsWidth") & @CRLF)
ConsoleWrite(DllStructGetData($DEVMODE, "dmPelsHeight") & @CRLF)
ConsoleWrite(DllStructGetData($DEVMODE, "dmDisplayOrientation") & @CRLF & @CRLF)
$B = DllCall($h_DLL_user32, "int", "ChangeDisplaySettingsEx", "ptr", 0, "ptr", DllStructGetPtr($DEVMODE), "hwnd", 0, "int", $CDS_UPDATEREGISTRY, "ptr", 0)
ConsoleWrite($B[0] & @TAB & @error & @CRLF)
$i_BitsPP = DllStructGetData($DEVMODE, "dmBitsPerPel")
$i_Width = DllStructGetData($DEVMODE, "dmPelsWidth")
$i_Height = DllStructGetData($DEVMODE, "dmPelsHeight")
_SendMessageTimeout_Ex($HWND_BROADCAST, $WM_DISPLAYCHANGE, $i_BitsPP, $i_Height * 2 ^ 16 + $i_Width)
Func _SendMessageTimeout_Ex($hWnd, $iMsg, $wParam = 0, $lParam = 0)
 Local $iRet = DllCall($h_DLL_user32, "lresult", "SendMessageTimeout", _
   "hwnd", $hWnd, _
   "uint", $iMsg, _
   "wparam", $wParam, _
   "lParam", $lParam, _
   "uint", $SMTO_ABORTIFHUNG, _
   "uint", $MSG_TIMEOUT, _
   "dword_ptr*", 0)
 Return $iRet[7]
EndFunc   ;==>_SendMessageTimeout_Ex
Link to comment
Share on other sites

Set the var $iOrientation_New according to your needs.

Yes, I know. I appreciate the reply though.

It does nothing if $iOrientation_New is set to $DMDO_180.

Like I said before, it works when it is set for 270 and 90. Just not 180 (flipped).

You also might want to check out my program ICU (sig) to save the Desktops Icon positions before rotating Posted Image...

Actually even when I run the 270 and 90 rotation modes, my icons stay where they are. Then again, I only have like 8 icons on my desktop anyways. (I'm a bit of an organization freak; don't judge me! :oops:)

Any more ideas?

Link to comment
Share on other sites

Did you test-run the script in post #10? It rotates by 180 degrees forth and back on a second run and works fine for me...

Woops. Sorry.

No I hadn't. I figured you were just telling me to change the variable in the previous ones xD... Sorry about that.

Yes. The latest code works amazingly thank you very much. Perfect.

Link to comment
Share on other sites

There is also a that Hermano created. It's included in the attachment. It's a little tool he wrote called iRotate. It run's in the system tray and allow you to rotate (obviously right) your desktop(s)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...