Solved

Using the CDialog::InitModalIndirect() function.

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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 tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

746 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

13 Experts available now in Live!

Get 1:1 Help Now