Solved

Dialog from within??

Posted on 1998-07-22
2
146 Views
Last Modified: 2013-11-20
Have greated my own dialog class which uses it's own DLGTEMPLATE instead of a resource.
Problem: Ignores the size I send it.
Solution: Called SetWindowPos(...,....,...) from within OnInitDialog() which solves it but this is a sloppy
way of doing it as I'm asked the dimension's early in DLGTEMPLATE ->cx and cy

Bitmap (dimensions 600 x 300);

->cx = 600 // should be width in pixels of a bmp
->cy = 300 // should be height in pixels of a bmp

created window ends up nearly twice as big a the bmp.

 
0
Comment
Question by:CONAN
2 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 100 total points
ID: 1319553
The problem is that the units in the DLGTEMPLATE are specified in DialogBaseUnits (see GetDialogBaseUnits()), as opposed to device units or pixels. You will need to the conversion ahead of time. By the way, SetWindowPos() uses device units.
0
 

Author Comment

by:CONAN
ID: 1319554
GetDialogBaseUnits() does not return correct dialog base units if the dialog is not using the system font. As the dialog was only displaying a bimap I had'nt included the DS_SETFONT style  flag so I was still getting the wrong result..
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

Title # Comments Views Activity
How do you programatically show and hide the Windows 10 On-Screen-Keyboard? 3 533
Named range not carried over 10 62
List out all word 7 259
zeroMAx challenge 20 87
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

911 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

16 Experts available now in Live!

Get 1:1 Help Now