Problem Adding ListBox 
Author Message
 Problem Adding ListBox

Hi:

I have a dialog-based DirectX9 application that I have a number of
controls on.

I want to add a listbox to it where I define a CListBox variable,
m_myVar, so I can manipulate the contents.  When I do this, however, I
get the compilation error:

MyProg.cpp: error C2065: 'IDC_LIST2' : undeclared identifier;

which points to the line that defines m_myVar;

DDX_Control(pDX, IDC_LIST2, m_myVar);.

The problem doesn't show up if I just add the listbox, only after I
define the variable m_myVar.

Screwing around with it I found that I can't define any new control
variables without causing this problem.  I also found I can define all
the control variables I want if I go back and start all over again, but
what a hassle to have to completely rebuild my application every time I
want to add a new control.

Can anyone give me any  ideas on how I can figure out what is causing
this compilation error and what I can do to prevent it?

TIA,
Brad McMillan



Sat, 10 Sep 2005 06:41:37 GMT  
 Problem Adding ListBox
Do you have a control with an id of IDC_LIST2 in the .RC file?  Does
MyProg.cpp have the appropriate #includes in it?


Quote:
> Hi:

> I have a dialog-based DirectX9 application that I have a number of
> controls on.

> I want to add a listbox to it where I define a CListBox variable,
> m_myVar, so I can manipulate the contents.  When I do this, however, I
> get the compilation error:

> MyProg.cpp: error C2065: 'IDC_LIST2' : undeclared identifier;

> which points to the line that defines m_myVar;

> DDX_Control(pDX, IDC_LIST2, m_myVar);.

> The problem doesn't show up if I just add the listbox, only after I
> define the variable m_myVar.

> Screwing around with it I found that I can't define any new control
> variables without causing this problem.  I also found I can define all
> the control variables I want if I go back and start all over again, but
> what a hassle to have to completely rebuild my application every time I
> want to add a new control.

> Can anyone give me any  ideas on how I can figure out what is causing
> this compilation error and what I can do to prevent it?

> TIA,
> Brad McMillan



Sat, 10 Sep 2005 14:52:29 GMT  
 Problem Adding ListBox

Yes, there is an entry in the .rc file:

LISTBOX         IDC_LIST2,26,82,425,42,NOT LBS_NOTIFY |
                    LBS_NOINTEGRALHEIGHT,WS_EX_TRANSPARENT

Also, the include list in MyProg.cpp has the following files listed:

#include "stdafx.h"
#include <process.h>
#include <Afxdisp.h>

I'm not sure which one is required for listboxes, but I assume the
correct one is here since I have another listbox in my application that
is working just fine.

Thank you for your input.

Brad McMillan

Quote:

>Do you have a control with an id of IDC_LIST2 in the .RC file?  Does
>MyProg.cpp have the appropriate #includes in it?



>>Hi:

>>I have a dialog-based DirectX9 application that I have a number of
>>controls on.

>>I want to add a listbox to it where I define a CListBox variable,
>>m_myVar, so I can manipulate the contents.  When I do this, however, I
>>get the compilation error:

>>MyProg.cpp: error C2065: 'IDC_LIST2' : undeclared identifier;

>>which points to the line that defines m_myVar;

>>DDX_Control(pDX, IDC_LIST2, m_myVar);.

>>The problem doesn't show up if I just add the listbox, only after I
>>define the variable m_myVar.

>>Screwing around with it I found that I can't define any new control
>>variables without causing this problem.  I also found I can define all
>>the control variables I want if I go back and start all over again, but
>>what a hassle to have to completely rebuild my application every time I
>>want to add a new control.

>>Can anyone give me any  ideas on how I can figure out what is causing
>>this compilation error and what I can do to prevent it?

>>TIA,
>>Brad McMillan



Sat, 10 Sep 2005 09:12:04 GMT  
 Problem Adding ListBox

While it's not necessarily incorrect, you should probably put #include <process.h> and #include <afxdisp.h> inside of the stdafx.h file since they are not going to be changed.

What class does MyProg.cpp contain?  Is it the application or the dialog?  Does your app's .H file contain a #include <resource.h>?

  Yes, there is an entry in the .rc file:

  LISTBOX         IDC_LIST2,26,82,425,42,NOT LBS_NOTIFY |
                      LBS_NOINTEGRALHEIGHT,WS_EX_TRANSPARENT

  Also, the include list in MyProg.cpp has the following files listed:

  #include "stdafx.h"
  #include <process.h>
  #include <Afxdisp.h>

  I'm not sure which one is required for listboxes, but I assume the correct one is here since I have another listbox in my application that is working just fine.

  Thank you for your input.

  Brad McMillan


Do you have a control with an id of IDC_LIST2 in the .RC file?  Does
MyProg.cpp have the appropriate #includes in it?


Hi:

I have a dialog-based DirectX9 application that I have a number of
controls on.

I want to add a listbox to it where I define a CListBox variable,
m_myVar, so I can manipulate the contents.  When I do this, however, I
get the compilation error:

MyProg.cpp: error C2065: 'IDC_LIST2' : undeclared identifier;

which points to the line that defines m_myVar;

DDX_Control(pDX, IDC_LIST2, m_myVar);.

The problem doesn't show up if I just add the listbox, only after I
define the variable m_myVar.

Screwing around with it I found that I can't define any new control
variables without causing this problem.  I also found I can define all
the control variables I want if I go back and start all over again, but
what a hassle to have to completely rebuild my application every time I
want to add a new control.

Can anyone give me any  ideas on how I can figure out what is causing
this compilation error and what I can do to prevent it?

TIA,
Brad McMillan



Sat, 10 Sep 2005 17:44:11 GMT  
 Problem Adding ListBox

MyProg.cpp contains the class CAppForm (with the base class CFormView)
which was generated by the DirectX AppWizard when I originally created
the project.  This is where the ClassWizard puts the "DDX_Control(pDX,
IDC_LIST2, m_myVar)" statement.

I did a search on resource.h and there is an #include "resource.h" in
StdAfx.h and a SOURCE=.\resource.h in Nms.dsp, but no #include
<resource.h> in my application.

Thanks again.

Quote:

> While it's not necessarily incorrect, you should probably put #include
> <process.h> and #include <afxdisp.h> inside of the stdafx.h file since
> they are not going to be changed.

> What class does MyProg.cpp contain?  Is it the application or the
> dialog?  Does your app's .H file contain a #include <resource.h>?




>     Yes, there is an entry in the .rc file:

>     LISTBOX         IDC_LIST2,26,82,425,42,NOT LBS_NOTIFY |
>                         LBS_NOINTEGRALHEIGHT,WS_EX_TRANSPARENT

>     Also, the include list in MyProg.cpp has the following files listed:

>     #include "stdafx.h"
>     #include <process.h>
>     #include <Afxdisp.h>

>     I'm not sure which one is required for listboxes, but I assume the
>     correct one is here since I have another listbox in my application
>     that is working just fine.

>     Thank you for your input.

>     Brad McMillan


>>Do you have a control with an id of IDC_LIST2 in the .RC file?  Does
>>MyProg.cpp have the appropriate #includes in it?



>>>Hi:

>>>I have a dialog-based DirectX9 application that I have a number of
>>>controls on.

>>>I want to add a listbox to it where I define a CListBox variable,
>>>m_myVar, so I can manipulate the contents.  When I do this, however, I
>>>get the compilation error:

>>>MyProg.cpp: error C2065: 'IDC_LIST2' : undeclared identifier;

>>>which points to the line that defines m_myVar;

>>>DDX_Control(pDX, IDC_LIST2, m_myVar);.

>>>The problem doesn't show up if I just add the listbox, only after I
>>>define the variable m_myVar.

>>>Screwing around with it I found that I can't define any new control
>>>variables without causing this problem.  I also found I can define all
>>>the control variables I want if I go back and start all over again, but
>>>what a hassle to have to completely rebuild my application every time I
>>>want to add a new control.

>>>Can anyone give me any  ideas on how I can figure out what is causing
>>>this compilation error and what I can do to prevent it?

>>>TIA,
>>>Brad McMillan



Sat, 10 Sep 2005 13:31:14 GMT  
 Problem Adding ListBox

While anything is possible, I've never seen a #include "resource.h" statement in the stdafx.h file.

  MyProg.cpp contains the class CAppForm (with the base class CFormView) which was generated by the DirectX AppWizard when I originally created the project.  This is where the ClassWizard puts the "DDX_Control(pDX, IDC_LIST2, m_myVar)" statement.

  I did a search on resource.h and there is an #include "resource.h" in StdAfx.h and a SOURCE=.\resource.h in Nms.dsp, but no #include <resource.h> in my application.

  Thanks again.



Sat, 10 Sep 2005 22:03:24 GMT  
 Problem Adding ListBox

I went and looked and there were another bunch of includes that were
obviously DirectX files so maybe it was put in there by the DirectX
AppWizard.

Do you think the "DDX_Control(pDX, IDC_LIST2, m_myVar)" statements are
being put in the wrong place (CAppForm) by ClassWizard?  If so, where
should I move it so that it's program will find the definition for
IDC_LIST2 in resource.h?

Thanks!

Quote:

> While anything is possible, I've never seen a #include "resource.h"
> statement in the stdafx.h file.




>     MyProg.cpp contains the class CAppForm (with the base class
>     CFormView) which was generated by the DirectX AppWizard when I
>     originally created the project.  This is where the ClassWizard
>     puts the "DDX_Control(pDX, IDC_LIST2, m_myVar)" statement.

>     I did a search on resource.h and there is an #include "resource.h"
>     in StdAfx.h and a SOURCE=.\resource.h in Nms.dsp, but no #include
>     <resource.h> in my application.

>     Thanks again.



Sat, 10 Sep 2005 16:37:35 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Problem adding items to a ListBox

2. Problem adding items to a ListBox

3. adding items to Listbox

4. !vb Listbox maximum 32768, how to add more list

5. How get newest item added to listbox

6. Add Item to ListBox with Javascript?

7. adding listbox/combobox style column in datagrid

8. Add item 2 listbox with tab (\t)

9. !vb Listbox maximum 32768, how to add more list

10. (Updating "Add/Remove Programs" ListBox)

11. add data to listbox

12. how to add items in a multicolumn listbox

 

 
Powered by phpBB® Forum Software