Every resource in MFC has an ID and you can get that with the combination of RC file and resource.h file values.

For Code you need to use the API GetDlgCtrlID function