Solved

Screen Resolution :

Posted on 2004-04-24
8
1,200 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

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…
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

773 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