Click to See Complete Forum and Search --> : CHange Orientation


sasi_kumar_irtt
November 30th, 2006, 05:26 AM
I want to change the orientation of the window in my application. To achieve this functionality i use the function ChangeDisplaySettingsEx.
Here is the values i specified.
DEVMODE devmode;
LONG ReturnValue;
devmode.dmSize = sizeof(DEVMODE);
SystemParametersInfo(SPI_GETWORKAREA,NULL,&rectValue,0);
rectResult.left = rectValue.left;
rectResult.top = rectValue.top;
rectResult.right = (rectValue.right - rectValue.left);
rectResult.bottom = (rectValue.bottom - rectValue.top);
devmode.dmFields = DM_DISPLAYORIENTATION;
devmode.dmPelsWidth = rectResult.right/2;
devmode.dmPelsHeight = rectResult.bottom;
devmode.dmDisplayOrientation = DMDO_90;
devmode.dmFields = DM_DISPLAYORIENTATION;
ReturnValue=ChangeDisplaySettingsEx(NULL, &devmode, NULL, 0, NULL);
The return value i obtained is DISP_CHANGE_BADMODE (-2)
Please help me what i have done work, and help me to achieve the functionality

Sasi

ovidiucucu
November 30th, 2006, 10:55 AM
I'm not sure that is the cause, but note that DM_DISPLAYORIENTATION requires Windows XP.

sasi_kumar_irtt
November 30th, 2006, 11:19 PM
Thanks for your reply.
I have tested that code in the Windows CE emulator 4.0 version.
Could that be a problem,if so for CE how shoudl i achieve that feature

NoHero
December 1st, 2006, 02:30 AM
Not if you have Windows CE .NET 4.0 or later.

sasi_kumar_irtt
December 4th, 2006, 02:18 AM
can anyone help me in this regard, im getting the same error BAD_MODE.


Tx
sasi