Solved

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

Posted on 1998-09-16
1
187 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
1 Comment
 
LVL 2

Accepted Solution

by:
jstolan earned 100 total points
Comment Utility
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
has77  challenge 9 66
pre4 challenge 19 87
matchUp  challenge 9 71
changeXy challenge 13 56
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: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

762 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

9 Experts available now in Live!

Get 1:1 Help Now