Solved

GetDlgItem() on a dialog in a formview?

Posted on 2001-06-06
9
596 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

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

Suggested Solutions

Title # Comments Views Activity
How to know only "File created" with EventLog 3 35
sumDigits challenge 9 178
fizzArray  challenge 1 114
haveThree challenge 22 126
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. …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.

738 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