Solved

Screen Resolution :

Posted on 2004-04-24
8
1,184 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
  • 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
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.

914 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now