Re: using SetBitmap
From: Jeff Partch (jeffp_at_mvps.org)
Date: 11/01/04
- Next message: Doug Harrison [MVP]: "Re: CString - Addition of large strings"
- Previous message: AliR: "Re: using SetBitmap"
- In reply to: hilla hartman: "using SetBitmap"
- Next in thread: AliR: "Re: using SetBitmap"
- Reply: AliR: "Re: using SetBitmap"
- Reply: hilla hartman: "Re: using SetBitmap"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 1 Nov 2004 13:36:00 -0600
"hilla hartman" <hillah@gmail.com> wrote in message
news:87877a19.0411011116.56e730b4@posting.google.com...
> Hi,
> I wrote a program that is a dialog box and has a callback function. In
> the callback function i need to change a picture that is in the dialog
> box.
> Since the Callback function isnt in the same class as the dialog box i
> cant use -(CStatic*) GetDlgItem( IDC_IMAGE);
> and have to use - (CStatic*) GetDlgItem(g_hwnd, IDC_IMAGE);
> In the first case it works... In the second case (which is what i
> actually need) it throws an exception.
> the code looks like this -
>
> hBitmap = (HBITMAP)::LoadImage( NULL, "c:\\tactix.bmp", IMAGE_BITMAP,
> 0, 0, LR_DEFAULTSIZE | LR_LOADFROMFILE);
>
> pImage = (CStatic*) GetDlgItem(g_hwnd, IDC_IMAGE);
> if (pImage != NULL)
> pImage->SetBitmap( hBitmap);
I suspect that GetDlgItem is returning an HWND...
...you can't cast an HWND to a CStatic*, but you might could use...
...and cast that CWnd* to a CStatic*. Or you might could just use
SendMessage and...
-- Jeff Partch [VC++ MVP]
- Next message: Doug Harrison [MVP]: "Re: CString - Addition of large strings"
- Previous message: AliR: "Re: using SetBitmap"
- In reply to: hilla hartman: "using SetBitmap"
- Next in thread: AliR: "Re: using SetBitmap"
- Reply: AliR: "Re: using SetBitmap"
- Reply: hilla hartman: "Re: using SetBitmap"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|