?
Solved

Using the CDialog::InitModalIndirect() function.

Posted on 1999-01-17
1
Medium Priority
?
2,339 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
[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 3

Accepted Solution

by:
plaroche earned 60 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
In this post we will learn different types of Android Layout and some basics of an Android App.
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 video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Suggested Courses

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