Discussion:
SetLayeredWindowAttributes not working in XP
(too old to reply)
rajesh
2010-08-13 02:26:56 UTC
Permalink
Raw Message
I use SetLayeredWindowAttributes for giving the dialogbox an irregular
shape .it is working fine in Vista ,win 7 , But in XP(SP2 ,SP3) it
shows the masked color .

I tried drawing the picture using GDI+ Graphics DrawImage and IPicture
interface . no luck. when i tried with a BMP image it works fine in
XP .but i need to draw a jpg or png . I am looking for some workaround
without using any external lib like libpng I am bitblt ing the Dialog
background on OnEraseBkgnd(CDC* pDC) . I tried googling but no luck so
far .

Thanks in Advance .
n***@rtrussell.co.uk
2010-08-14 16:37:10 UTC
Permalink
Raw Message
Post by rajesh
I use SetLayeredWindowAttributes for giving the dialogbox an irregular
shape .it is working fine in Vista ,win 7 , But in XP(SP2 ,SP3) it
shows the masked color.
This has nothing to do with SetLayeredWindowAttributes. The problem
is loading your image - how do you do that? LoadImage and LoadBitmap
don't support JPG or PNG images under WinXP.
Post by rajesh
I am looking for some workaround without using any external lib
Two possibilities:

1. Load a JPG image using OleLoadPicturePath and then get its handle
by calling IPicture::get_Handle

2. Load a JPG or PNG image using GdipCreateBitmapFromFile and then
get its handle by calling GdipCreateHBITMAPFromBitmap (you can use the
C++ interfaces rather than the 'flat' interfaces if you prefer).

Once you've got an HBITMAP you can select it into your DC and BitBlt
it as before.

Richard.
http://www.rtrussell.co.uk/

Loading...