?
Solved

How to detect the resolution and control the size of a Form?

Posted on 2007-08-08
3
Medium Priority
?
160 Views
Last Modified: 2010-04-30
Hello group,

I'm using VB 6.0 for a project which creates a dialog (form) in Excel environment. However,  When the resolution changes by user, I want it to keep its size (height and width) in an appropriate.

How can I do this?

regards,
ak
0
Comment
Question by:akohan
  • 2
3 Comments
 
LVL 53

Assisted Solution

by:Dhaest
Dhaest earned 600 total points
ID: 19652110
0
 
LVL 53

Assisted Solution

by:Dhaest
Dhaest earned 600 total points
ID: 19652115
How To Create a Resolution-Independent Form
http://support.microsoft.com/kb/182070
0
 
LVL 2

Accepted Solution

by:
patilmmilind earned 1400 total points
ID: 19660326
Hi,
First you have to continuously monitor for is there any change in the resoulation. To find it out you can use following Win32 API Calls. When your program starts store these setings somewhere in your code using variables. After that start a thread (You can use Timer) which will fire these Win32 API calls and read current screen resoulation. Compare this information with you have initially. If there is any change, replace initial resoulation information with the new one and resize the form.

Public Declare Function GetDeviceCaps Lib "gdi32" _
   (ByVal hdc As Long, _
    ByVal nIndex As Long) As Long

Dim currHRes As Long
Dim currVRes As Long
Dim currBPP As Long

currHRes = GetDeviceCaps(hdc, HORZRES)
   currVRes = GetDeviceCaps(hdc, VERTRES)
   currBPP = GetDeviceCaps(hdc, BITSPIXEL)

For Sample code, try this link: http://vbnet.mvps.org/index.html?code/enums/enumdisplaychange.htm

Regards,
Best Luck

Milind
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

839 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