Gold mine of Visual C++ tricks!
How to Change the Display Orientation?
![]()
Are you using Windows XP? Press Ctrl+Atl+DownArrow, and then Ctrl+Atl+UpArrow. The screen changes its orientation upside down. isn’t it? But how to turn the screen, upside down programmatically?

Image Courtesy – marieforleo.com
![]()
Get the current DEVMODE by calling -EnumDisplaySettings(). Then change orientation by setting DEVMODE.dmDisplayOrientation and calling ChangeDisplaySettings(). Have a look at the code snippet. Code taken from MSDN.
// Get current Device Mode.
DEVMODE DeviceMode = { 0 };
EnumDisplaySettings( NULL,
ENUM_CURRENT_SETTINGS,
&DeviceMode );
// Change display mode upside down.
DeviceMode.dmDisplayOrientation = DMDO_180;
ChangeDisplaySettings( &DeviceMode, 0 );
// Sleep for 10 seconds.
Sleep( 10000 );
// Change display mode back.
DeviceMode.dmDisplayOrientation = DMDO_DEFAULT;
ChangeDisplaySettings( &DeviceMode, 0 );
![]()
Be careful to restore the display orientation back. Or else
![]()
Targeted Audiance – Intermeidate.
| Print article | This entry was posted by Jijo Raj on May 10, 2009 at 4:42 pm, and is filed under Uncategorized. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |










about 1 year ago
What are you talking about? I have XP and ctrl+alt+down,ctrl+alt+up does nothing. Where did you get this information?
about 1 year ago
this site have a lot of fun and great articles, thanks
about 1 year ago
http://blogs.msdn.com/oldnewthing/archive/2009/06/04/9695342.aspx
about 1 year ago
Hi leochou,
Thanks for the link! Keep watching!
Regards,
Jijo.