The titlebar icon can also be removed independently from the min/max/exit buttons, by using extended styles (tested only on dialogs, don't know how it behaves on windows).
Paste the following code into your dialog's OnInitDialog()
method and it should work:
// Disable default titlebar icon
int extendedStyle = GetWindowLong(m_hWnd, GWL_EXSTYLE);
SetWindowLong(m_hWnd, GWL_EXSTYLE, extendedStyle | WS_EX_DLGMODALFRAME);
// Update non-client area of the dialog, for the changes to take effect
SetWindowPos(NULL, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER);
I have also unsuccessfully tried the SetIcon()
method and many other proposed solutions/hacks and besides the upper (i.e. extended styles) none has been worked.
EDIT:
I've just stumbled apon a much simpler equivalent to the upper code:
Just add DS_MODALFRAME
to the dialog box styles, along with WS_CAPTION
and WS_SYSMENU
.
https://msdn.microsoft.com/en-us/library/windows/desktop/ff729172%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396