Solved

Screen Resolution :

Posted on 2004-04-24
8
1,240 Views
Last Modified: 2013-12-26
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
Comment
Question by:Mateen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 

Author Comment

by:Mateen
ID: 10915580
????
0
 

Author Comment

by:Mateen
ID: 10915985
Desperately waiting for some feed back by dear experts.
0
 
LVL 5

Assisted Solution

by:berXpert
berXpert earned 200 total points
ID: 10933215
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 18

Expert Comment

by:diasroshan
ID: 10936229
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
 
LVL 18

Accepted Solution

by:
diasroshan earned 300 total points
ID: 10936295
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
 

Author Comment

by:Mateen
ID: 10936663
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
 

Author Comment

by:Mateen
ID: 10936701
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
 
LVL 18

Expert Comment

by:diasroshan
ID: 10936763

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

Cheers,
Rosh
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question