Solved

Using the CDialog::InitModalIndirect() function.

Posted on 1999-01-17
1
2,242 Views
Last Modified: 2013-11-20
I need a code example for using the:
CDialog::InitModalIndirect().

I am trying to use the next code but no dialog apears and the DoModal() function return immediatly.

DLGTEMPLATE lpDialogTemplate;
lpDialogTemplate.style=DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE;
lpDialogTemplate.dwExtendedStyle=0;
lpDialogTemplate.cdit=0;
lpDialogTemplate.x=0;
lpDialogTemplate.y=0;
lpDialogTemplate.cx=100;
lpDialogTemplate.cy=100;


CDialog Dialog;
int Result = Dialog.InitModalIndirect(&lpDialogTemplate,this);
Result = Dialog.DoModal();
0
Comment
Question by:zona
1 Comment
 
LVL 3

Accepted Solution

by:
plaroche earned 30 total points
ID: 1327853
If you read the doc for DOCTEMPLATE you will see that you need to allocate other items directly following the structure in memory. Namely menu array, class array and title array. there is also variable amount of DLGITEMTEMPLATE items to be allocated following this in memory.

Memory view:

0x0000 DIALOGTEMPLATE
0x.... MENU array
0x.... Window Class array
0x.... Title array
0x.... one or more DLGITEMTEMPLATE structs...

I suggest you take a look at the DLGTEMPL sample, it is quite a complicated task to do dynamic dialog creation like this.

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

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 Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
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.

867 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

23 Experts available now in Live!

Get 1:1 Help Now