Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1274
  • Last Modified:

Screen Resolution :

http://www.experts-exchange.com/Programming/Programming_Languages/PowerBuilder/Q_20950860.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.




0
Mateen
Asked:
Mateen
  • 4
  • 3
2 Solutions
 
MateenAuthor Commented:
????
0
 
MateenAuthor Commented:
Desperately waiting for some feed back by dear experts.
0
 
berXpertCommented:
Hi Mateen,

I just tested your code and noted you copied same script for open as for closequery, I fixed it and is:

Closequery event:

devmode dm
long ret

CurrHRes = GetSystemMetrics(0)
CurrVRes = GetSystemMetrics(1)

if i_prv_width = i_std_width and i_prv_height = i_std_height then return

dm.dmPelsWidth  = i_prv_width
dm.dmPelsHeight = i_prv_height
dm.dmBitsPerPel = i_prv_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


//*****************


Runing this window always my taskbar is placed at bottom, I can't replicate your problem here. Can you take a snapshot of your screen and send to berXpert AT yahoo DOT com DOT mx   to see how it looks in your PC.

berX
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
diasroshanCommented:
hi mateen,

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

http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20600262.html

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



Cheers,
Rosh
0
 
diasroshanCommented:
hi mateen,

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

Cheers,
Rosh
0
 
MateenAuthor Commented:
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:


0
 
MateenAuthor Commented:
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 http://www.experts-exchange.com/Programming/Programming_Languages/PowerBuilder/Q_20968630.html
http://www.experts-exchange.com/Programming/Programming_Languages/PowerBuilder/Q_20950860.html contains the same topic, so please give comments in all, enabling me to accept and close all questions.

Mateen:
0
 
diasroshanCommented:

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

Cheers,
Rosh
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now