?
Solved

How can I find the size of a dialog before it is displayed?

Posted on 1998-09-16
1
Medium Priority
?
234 Views
Last Modified: 2013-11-20
From the .rc file I have the following:

IDD_DIALOG4 DIALOG DISCARDABLE  0, 0, 186, 95

How can I get access to the numbers 186 and 95 before the
dialog gets displayed?

Here is what I would like to do:

m_myDlg = new MyDlg;
m_myDlg->Create(IDD_DIALOG4, this);

SomeHowGetMyDlgSize(  )  //get the number 186  95
.
.
.

Thanks,
-Eric
0
Comment
Question by:nielsew
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 2

Accepted Solution

by:
jstolan earned 400 total points
ID: 1322181
The steps are as follows

1.  Use FindResourceEx to get a handle to the dialog resource

2.  Use LoadResource to load the resultant location into memory

3.  Use LockResource to get a pointer to the resource

The pointer will point to a dialog template structure as defined below.  Control items will follow but you don't care about them.  The cx and xy parameters are the ones you want.

typedef struct {    
DWORD style;    
DWORD dwExtendedStyle;
WORD  cdit;    
short x;    
short y;    
short cx;    
short cy;
} DLGTEMPLATE;

4.  It is not necessary to unlock or free this memory (at least according to the docs).  Careful, if you specifed the extended dialog box format the structure will be different from that described above.  Note that you can get this information at anytime, you don't even need to create the dialog box.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Suggested Courses
Course of the Month11 days, 1 hour left to enroll

770 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