Solved

Dialog from within??

Posted on 1998-07-22
2
148 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

810 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