Link to home
Start Free TrialLog in
Avatar of Mateen
Mateen

asked on

Screen Resolution :

https://www.experts-exchange.com/questions/20950860/CHANGING-DISPLAY-SETTING-THROUGH-PROGRMME.html may please be referred.

After making some chnages

THERE IS ONLY ONE PROBLEM NOW. WHEN THE RESOLUTION CHANGES TO 1024 X 768 THEN THE TASKBAR LINE (BOTTOM LINE WHICH CONTAINS START BUTTON AND OTHER APPLICATION WHEN MINIMIZED) IS CHANGING ITS PLACE. IT IS MOVING UP ROUGHLY 1/5TH OF THE SCREEN.


My window contains as under:

Window Name : w_res2

Instance Variables:
long CurrHRes ,CurrVRes ,CurrBPP

ulong DM_BITSPERPEL_H = 4*16*16*16*16
long DM_PELSWIDTH_H = 8*16*16*16*16
long DM_PELSHEIGHT_H = 16*16*16*16*16
long DM_DISPLAYFLAGS_H = 2*16*16*16*16*16
long CDS_FORCE = 4*16*16*16*16*16*16*16

long       i_std_width  = 1024
long      i_std_height = 768
long  i_std_perl   = 16
long       i_prv_width  =0
long      i_prv_height =0
long  i_prv_perl   =0

long i_std_bpp=16

Local External Functions:
FUNCTION long ChangeDisplaySettingsA (ref devmode lpst, ulong Flags) LIBRARY "USER32.DLL"
FUNCTION int GetSystemMetrics(int indexnum) LIBRARY "user32.dll"

Open Event:
devmode dm
long ret

CurrHRes = GetSystemMetrics(0)
CurrVRes = GetSystemMetrics(1)
i_prv_width=currHres
i_prv_height=currVres
i_prv_perl=i_std_perl     //=16

if i_prv_width = i_std_width and i_prv_height = i_std_height then return

dm.dmPelsWidth  = i_std_width
dm.dmPelsHeight = i_std_height
dm.dmBitsPerPel = i_std_perl

dm.dmFields = DM_PELSWIDTH_H + DM_PELSHEIGHT_H + DM_BITSPERPEL_H + DM_DISPLAYFLAGS_H

dm.dmSize = 148

ret = ChangeDisplaySettingsA(dm, CDS_FORCE)    

CurrBPP  = i_std_bpp

CloseQuery Event:
devmode dm
long ret

CurrHRes = GetSystemMetrics(0)
CurrVRes = GetSystemMetrics(1)
i_prv_width=currHres
i_prv_height=currVres
i_prv_perl=i_std_perl     //=16

if i_prv_width = i_std_width and i_prv_height = i_std_height then return

dm.dmPelsWidth  = i_std_width
dm.dmPelsHeight = i_std_height
dm.dmBitsPerPel = i_std_perl

dm.dmFields = DM_PELSWIDTH_H + DM_PELSHEIGHT_H + DM_BITSPERPEL_H + DM_DISPLAYFLAGS_H

dm.dmSize = 148

ret = ChangeDisplaySettingsA(dm, CDS_FORCE)    

CurrBPP  = i_std_bpp

When the window w_res2 is run the screen resolution successfully changes to 1024 x 768 and when the window is closed
the screen resolution is changed back to its original value.




Avatar of Mateen
Mateen

ASKER

????
Avatar of Mateen

ASKER

Desperately waiting for some feed back by dear experts.
SOLUTION
Avatar of berXpert
berXpert
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
hi mateen,

just go thru the following link... i'm sure ur problem will be solved...

https://www.experts-exchange.com/questions/20600262/Change-Screen-Resolution-Doesn't-move-status-Bar.html

it says u need to pass  CDS_UPDATEREGISTRY .... u have tried with CDS_FORCE....



Cheers,
Rosh
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mateen

ASKER

Hi berXpert

When I opened this question today I saw that comments have come from u and diaroshan:

Since diaroshan said:
eureka... problem solved...

just declare the following instance variable....

Long CDS_UPDATEREGISTRY = 1

...and replace CDS_FORCE with CDS_UPDATEREGISTRY throughout ur code and ur status bar problem is solved....

So I didn't test your code and did as said by dia. The problem seems to be gone now. I do believe that If I had given you the snapshot u asked you would have also spotted my problem area.

Anyway, thanks for your efforts and it would be appreciated by me.

Mateen:


Avatar of Mateen

ASKER

Thanks Dia:

Did as suggested by u. Seems to be quite ok now.

I have tested this in windows 2000 professional. Would it be same for the following environment.

Windows 98
Windows XP Home Edition

BTW, Since https://www.experts-exchange.com/questions/20968630/Screen-Resolution.html
https://www.experts-exchange.com/questions/20950860/CHANGING-DISPLAY-SETTING-THROUGH-PROGRMME.html contains the same topic, so please give comments in all, enabling me to accept and close all questions.

Mateen:

Mateen,
glad to help and ur question helped me come across a lot of my issues too..

Cheers,
Rosh