Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Rotate display by 270 degrees


  • Please log in to reply
16 replies to this topic

#1 KaFu

KaFu

    Hey, it's just me, KhaFoo...

  • MVPs
  • 3,407 posts

Posted 02 March 2012 - 09:57 AM

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.

AutoIt         
$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







#2 water

water

    ?

  • MVPs
  • 15,747 posts

Posted 02 March 2012 - 10:07 AM

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, 02 March 2012 - 10:08 AM.

UDFs:
Active Directory (NEW 2014-07-21 - Version 1.4.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2014-07-27 - Version 1.0.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2013-01-21 - Version 0.3.1.1) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

#3 KaFu

KaFu

    Hey, it's just me, KhaFoo...

  • MVPs
  • 3,407 posts

Posted 02 March 2012 - 10:13 AM

DISP_CHANGE_BADMODE = -2
The reason might be that you have attached two displays and the key-combo does not use ChangeDisplaySettingsEx internally?

Edited by KaFu, 02 March 2012 - 10:13 AM.


#4 KaFu

KaFu

    Hey, it's just me, KhaFoo...

  • MVPs
  • 3,407 posts

Posted 02 March 2012 - 01:05 PM

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))

AutoIt         
$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)


#5 water

water

    ?

  • MVPs
  • 15,747 posts

Posted 02 March 2012 - 03:11 PM

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.
UDFs:
Active Directory (NEW 2014-07-21 - Version 1.4.1.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2014-07-27 - Version 1.0.0.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2013-01-21 - Version 0.3.1.1) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

#6 KaFu

KaFu

    Hey, it's just me, KhaFoo...

  • MVPs
  • 3,407 posts

Posted 02 March 2012 - 03:38 PM

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.

#7 AccountKiller

AccountKiller

    Seeker

  • Active Members
  • 9 posts

Posted 23 March 2012 - 10:33 AM

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

#8 KaFu

KaFu

    Hey, it's just me, KhaFoo...

  • MVPs
  • 3,407 posts

Posted 23 March 2012 - 10:32 PM

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

AutoIt         
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


#9 AccountKiller

AccountKiller

    Seeker

  • Active Members
  • 9 posts

Posted 27 March 2012 - 03:47 AM

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, 27 March 2012 - 04:09 AM.


#10 KaFu

KaFu

    Hey, it's just me, KhaFoo...

  • MVPs
  • 3,407 posts

Posted 27 March 2012 - 07:40 AM

Set the var $iOrientation_New according to your needs.

AutoIt         
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


#11 KaFu

KaFu

    Hey, it's just me, KhaFoo...

  • MVPs
  • 3,407 posts

Posted 27 March 2012 - 07:43 AM

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

#12 AccountKiller

AccountKiller

    Seeker

  • Active Members
  • 9 posts

Posted 29 March 2012 - 10:55 AM

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?

#13 KaFu

KaFu

    Hey, it's just me, KhaFoo...

  • MVPs
  • 3,407 posts

Posted 29 March 2012 - 12:53 PM

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...

#14 AccountKiller

AccountKiller

    Seeker

  • Active Members
  • 9 posts

Posted 30 March 2012 - 03:13 PM

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.

#15 spudw2k

spudw2k

    passionately misinformed

  • Active Members
  • PipPipPipPipPipPip
  • 1,331 posts

Posted 30 March 2012 - 03:29 PM

There is also a neat script here 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)

#16 Blue_Drache

Blue_Drache

    Revolutionary Flavour

  • Active Members
  • PipPipPipPipPipPip
  • 3,534 posts

Posted 30 March 2012 - 04:08 PM

I just usually pick it up and re-mount the base. *Shrug*
Lofting the cyberwinds on teknoleather wings, I am...The Blue DrachePosted ImagePosted Image

#17 Rogue5099

Rogue5099

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 428 posts

Posted 31 March 2012 - 07:11 AM

Smartee helped me out restoring the orientation of the screen. Maybe this will help you rotating it 270 degreed.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users