The MFC uses CWnd::GetDlgItem and uses an existing pointer to the parent window or dialog as a member of CWnd.
see:
https://learn.microsoft.com/en-us/cpp/mfc/reference/cwnd-class?view=msvc-170#getdlgitem
Unfortunately, it is not clear from the question what the non-functioning call currently looks like.
According to the documentation, there are two possible methods for an MFC program:
CWnd* GetDlgItem(int nID) const;
void GetDlgItem( int nID, HWND* phWnd) const;
There is also a Win32 API function with the same name for dialog boxes
HWND GetDlgItem( [in, optional] HWND hDlg, [in] int nIDDlgItem);