Displaying an image on ATL Dialog

  • Thread starter Thread starter Michael Bray
  • Start date Start date
M

Michael Bray

I'm trying to display an image on an ATL Dialog form in VS2003... I think
I am able to load an image (a GIF) w/ CImage.Load, and I'm trying to call
the SetBitmap followed by Invalidate on the CStatic that I get, but no
image appears... I'm doing this in OnInitDialog(...). any help?
 
I'm trying to display an image on an ATL Dialog form in VS2003... I
think I am able to load an image (a GIF) w/ CImage.Load, and I'm
trying to call the SetBitmap followed by Invalidate on the CStatic
that I get, but no image appears... I'm doing this in
OnInitDialog(...). any help?

Hmmm I just realized something that might change what I said above...
the .SetBitmap function is actually defined in a set of headers that I
got off the internet somewhere... basically what it ends up doing is a
SendMessage with STM_SETIMAGE:

HBITMAP SetBitmap(HBITMAP hBitmap)
{
ATLASSERT(::IsWindow(m_hWnd));
return (HBITMAP)::SendMessage(m_hWnd, STM_SETIMAGE, IMAGE_BITMAP,
(LPARAM)hBitmap);
}

my code:

CImage img;
LPCTSTR ctiLogo = L"c:\\\\coleman_logo.gif";
if (img.Load(ctiLogo) == S_OK)
{
ATLControls::CStatic pic = GetDlgItem(IDC_CTI_LOGO);
pic.SetBitmap(img);
pic.Invalidate();
}


Still not working, of course, but I figured a lot of you might say "what
is SetBitmap??"

-mdb
 
Back
Top