Solved

Dialog from within??

Posted on 1998-07-22
2
141 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
Comment Utility
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
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

772 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