Solved

GetDlgItem() on a dialog in a formview?

Posted on 2001-06-06
9
587 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
  • 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
 
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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Powershell based monitoring system 2 127
while loop over for loop 7 79
SQUD PROXY SERVER, UNIX, SLL/HTTPS 5 50
Thin secure Windows 10 5 49
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

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

15 Experts available now in Live!

Get 1:1 Help Now