I'm using Visual Studio 2010 to create a MFC application. I've created a simple dialog with the help of the recource editor. The dialog contains a number of Edit Controls. I've added members to those Edit Controls by rightclicking on them - > Add Variable. Lets say I have an Edit Control with ID = ID_EDB_NAME
and lets say ID_EDB_NAME = 1111
for this example.I have added a variable CEdit m_edbName
. Is there any method that I can call from m_edbName
that returns 1111
?
Asked
Active
Viewed 1,234 times
0

VTodorov
- 953
- 1
- 8
- 25
-
3You are probably looking for the [`GetDlgCtrlID`](https://msdn.microsoft.com/en-us/library/1shyeyy5.aspx) function – Jabberwocky May 22 '17 at 09:02
-
The resource file format does not allow you to create a resource of type Edit Control. Hence, your Edit Control doesn't have a resource ID (the parent dialog does, though). You are looking for the **control** ID, and the comment by @MichaelWalz explained, how to retrieve it. – IInspectable May 22 '17 at 10:38
-
@IInspectable I didn't quite get your statement _The resource file format does not allow you to create a resource of type Edit Control_. I'm doing this all the time. – Jabberwocky May 22 '17 at 11:22
-
@MichaelWalz: These are the [predefined resource types](https://msdn.microsoft.com/en-us/library/windows/desktop/ms648009.aspx). As you can see, there isn't one for (edit) controls, or even generic windows. An [EDITTEXT](https://msdn.microsoft.com/en-us/library/windows/desktop/aa381009.aspx) resource-definition statement can only appear inside a container, not as a top-level resource-definition statement. Only top-level resources have resource IDs. – IInspectable May 22 '17 at 11:36
-
@IInspectable OK, I just misunderstood your comment. – Jabberwocky May 22 '17 at 12:07