Solved

GetDlgItem() on a dialog in a formview?

Posted on 2001-06-06
9
594 Views
Last Modified: 2013-11-20
I have a CFormView object which contains some controls.  In the code for this class I add a dialog to this formview.  I have some 3rdparty library that uses the IDs of the items on my formview to move things around.  I want it to move the dialog around, but it uses GetDlgItem on the IDs to get ahold of the controls, and this doesn't work on the dialog.  

So the simple question, is it not possible to use GetDlgItem() on an actual dialog?  I'm guessing not but want to be sure.
0
Comment
Question by:appleby
[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
  • 4
  • 4
9 Comments
 
LVL 4

Expert Comment

by:captainkirk
ID: 6160979
1) Is the diaog a child of the form view?
2) how are you creating the dialog?
0
 

Author Comment

by:appleby
ID: 6160996
The dialog is a child of the form view.  
I am creating the dialog thus:

        Dialog1* dlg;
     dlg = new Dialog1;
     ASSERT(dlg);
     VERIFY(dlg->Create(IDD_DIALOG1, this));

inside the formview class.

I know there is a GetDlgItem() version that takes a pointer to the window, as well as the ID.  Also there is the framework version that works on any two windows that are parent/child.  But the library I'm calling does not allow for use of either of these versions.
0
 

Author Comment

by:appleby
ID: 6161024
The dialog is a child of the form view.  
I am creating the dialog thus:

        Dialog1* dlg;
     dlg = new Dialog1;
     ASSERT(dlg);
     VERIFY(dlg->Create(IDD_DIALOG1, this));

inside the formview class.

I know there is a GetDlgItem() version that takes a pointer to the window, as well as the ID.  Also there is the framework version that works on any two windows that are parent/child.  But the library I'm calling does not allow for use of either of these versions.
0
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!

 
LVL 12

Expert Comment

by:migel
ID: 6161067
Hi!
you must handle child dialog instead view:
that is:
CWnd* pCtl = dlg->GetDlgItem(IDC_ITEM_YOU_WANT);
where dlg is a pointer to the created dialog
0
 
LVL 4

Expert Comment

by:captainkirk
ID: 6161082
It should work with any parent-child relationship - I will build a test project and get back to you...
0
 

Author Comment

by:appleby
ID: 6161096
Migel - Let me clarify.  The 3rdparty library I'm calling is what is calling GetDlgItem(), not me.  I don't have control over that.  The call by me is like this:

third_party_function(IDD_DIALOG1);

I have to pass in the ID of a control within my formview, and the function does some stuff to it, including calling GetDlgItem(IDD_DIALOG).  I have no power over that.
0
 
LVL 4

Expert Comment

by:captainkirk
ID: 6161099
It should work with any parent-child relationship - I will build a test project and get back to you...
0
 
LVL 4

Accepted Solution

by:
captainkirk earned 50 total points
ID: 6161246
Looks like the MSDN docs are incorrect - I can't yet seem to make the GetDlgItem() call work either...
0
 

Author Comment

by:appleby
ID: 6161304
Ok, thanks.

I didn't want to have to, but since I have access to the source for the 3rd party library I'm going to rewrite it to work the way I need to.

Thanks for the sanity check.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Title # Comments Views Activity
Creating Labels and Frequency list style reports in SAS code 9 113
sumDigits challenge 9 172
fizzArray2 challenge 1 102
changeXy challenge 13 93
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.

756 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