-
Set a focus to a button
I want t set a focus on a button. When I use the shown code in MFC for an edit control:
Code:
::SetFocus(
::GetDlgItem(
GetSafeHwnd(), // HWND of the dialog window
<id> ) );
everything goes OK. But when I try it for a button it failes.
However this code:
Code:
GetDlgItem( <id> )->SetFocus();
works well in both cases. What is the difference.
At last, what I must to do to set focus to a button in WINAPI, if my method is wrong?
-
Well...call 'GetLastError()' to retrieve the specific error code of 'SetFocus()'.