From: Hector Santos on
Problem resolved using the proper constructor and initializing.

Hector Santos wrote:

> I'm trying to set the header background image of a wizard mode property
> sheet programmatically in my subclass contructor, like so:
>
> CwcListSheet::CwcListSheet(CWnd* pWndParent)
> : CPropertySheet(IDS_PROPSHT_CAPTION, pWndParent)
> {
>
> #if 1 // explore wizard header image
>
> CBitmap bmHeader;
> bmHeader.LoadBitmap(IDB_BITMAP1);
> m_psh.hbmHeader = bmHeader;
> m_psh.dwFlags |= (PSH_USEHBMHEADER | PSH_HEADER);
> m_psh.dwSize = sizeof(m_psh);
>
> #endif
>
> AddPage(&m_Page1);
> AddPage(&m_Page2);
> AddPage(&m_Page3);
> AddPage(&m_Page4);
> AddPage(&m_Page5);
>
> m_psh.dwFlags |= PSH_WIZARD97;
> m_psh.dwFlags |= PSH_NOAPPLYNOW;
> m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
> }
>
> and it doesn't show up.
>
> The LoadBitMap()is not failing. What I am missing here?
>
> Thinking the local scope would destroy the image, I even created the
> object dynamically to see if that makes a difference.
>
> CBitmap *bmHeader = new CBitmap;
> bmHeader->LoadBitmap(IDB_BITMAP1);
> m_psh.hbmHeader = *bmHeader;
>
> It didn't.
>
> TIA
>



--
HLS