Solved

Using the CDialog::InitModalIndirect() function.

Posted on 1999-01-17
1
2,299 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 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

737 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