Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » Please teach a method to acquire a standard icon Collapse All
Subject Author Date
tera tera Apr 7, 2009 - 8:24 PM

Hello




When the icon of the dialogue is unestablished, it is displayed.



I want to acquire this standard icon.


Please teach a good method.

tera tera Apr 8, 2009 - 6:45 PM

Hello.



In a Dwm mode,

To draw Window caption in my application.


Therefore I want to acquire this standard icon.

Is not there the command that can acquire this standard icon?


I wonder if I cannot but prepare standard icon.

Technical Support Apr 9, 2009 - 2:45 AM

You should use both the WM_GETICON message and GCL_HICON window class property:
<pre>CWnd * pWnd = . . .
HICON hIcon = NULL;
if( pWnd->GetSafeHwnd() != NULL )
{
hIcon = (HICON)(__EXT_MFC_DWORD_PTR) ::SendMessage( pWnd->m_hWnd, WM_GETICON, ICON_BIG, 0L );
if( hIcon == NULL )
{
hIcon = (HICON)(__EXT_MFC_DWORD_PTR) ::SendMessage( pWnd->m_hWnd, WM_GETICON, ICON_BIG, 0L );
if( hIcon == NULL )
{
hIcon = (HICON)(__EXT_MFC_DWORD_PTR) ::__EXT_MFC_GetClassLong( pWnd->m_hWnd, __EXT_MFC_GCL_HICON );
if(hIcon == NULL)
hIcon = ::AfxGetApp()->LoadStandardIcon( IDI_WINLOGO );
} // if( hIcon == NULL )
} // if( hIcon == NULL )
} // if( pWnd->GetSafeHwnd() != NULL )
if( hIcon != NULL )
{
. . .
}
<pre>

Technical Support Apr 8, 2009 - 7:54 PM

You should use both the WM_GETICON message and the GCL_HICON window class property:

CWnd * pWnd = . . .
            HICON hIcon = NULL;
            if( pWnd->GetSafeHwnd() != NULL )
            {
                        hIcon = (HICON)(__EXT_MFC_DWORD_PTR) ::SendMessage( pWnd->m_hWnd, WM_GETICON, ICON_BIG, 0L );
                        if( hIcon == NULL ) 
                        {
                                    hIcon = (HICON)(__EXT_MFC_DWORD_PTR) ::SendMessage( pWnd->m_hWnd, WM_GETICON, ICON_BIG, 0L );
                                    if( hIcon == NULL ) 
                                    {
                                                hIcon = (HICON)(__EXT_MFC_DWORD_PTR) ::__EXT_MFC_GetClassLong( pWnd->m_hWnd, __EXT_MFC_GCL_HICON );
                                                if(hIcon == NULL) 
                                                            hIcon = ::AfxGetApp()->LoadStandardIcon( IDI_WINLOGO );
                                    } // if( hIcon == NULL ) 
                        } // if( hIcon == NULL ) 
            } // if( pWnd->GetSafeHwnd() != NULL )
            if( hIcon != NULL )
            {
                        . . .
            }


tera tera Apr 10, 2009 - 2:53 AM

Thank you very much.


 

Technical Support Apr 8, 2009 - 6:48 AM

You should assign a window icon or remove the WS_SYSMENU style.