How to get correct Control ID by using HWND? MFC C++

Hi all. I'm trying to get the control id of button in a dialog by using hwnd that I initially get. I had search a lots of Q&A about this topic but those suggestion still can't work for me.

I use GetDlgCtrlID to get the control id but it always return to me 0x0000058D (control id not found). Then, I followed the suggestion which is add GetFocus() but it return to me 0x00000005 (access denied).

Does anyone know why this happened or got a solid steps to get the control id by using hwnd? The hwnd is valid but when comes to GetDlgCtrlID it looks like can't function well.

Last edited on
Does that window have a suitable id? How come that you don't know the id?
Registered users can post here. Sign in or register to post.