Comme dab j'ai encore une question à la c..

Je voudrais mettre une image a fond transparent sur une fenetre qui elle meme est transparente.
Je m'explique :
J'ai trouvé 2 splendides codes, le premier de FLYPE (Fenetre transparente avec fond du bureau), le second de DANILO (Image a fond transparent), et je voudrais les marier pour qu'ils vivent heureux et avoir de beaux ...

Malheureusement, comme vous le savez je ne suis pas un bon curé, et je ne connais pas la messe qui permet de faire ce miracle.

Peut etre qu'un dieu de ce site peu aider le petit pretre de cette paroisse

L'image est bien a fond transparent, mais elle prend le fond system de la fenetre et comme la fenetre n'a pas de fond ou de couleur ??????

Ou bien si quelqu'un connait un mariage plus judicieux pour faire ce que j'aimerais faire ???
Code : Tout sélectionner
Procedure CatchTransparentImage(Number,ImageLabel,TransColor,NewColor)
;>
;> Number = ImageNumber
;> ImageLabel = Label of the included Image
;> TransColor = RGB: Transparent Color, -1 = First Color in Picture
;> NewColor = RGB: New Color for TransColor, -1 = System Window Background
;>
Structure _CTI_BITMAPINFO
bmiHeader.BITMAPINFOHEADER
bmiColors.RGBQUAD[1]
EndStructure
Structure _CTI_LONG
l.l
EndStructure
Structure _CTI_WORD
w.w
EndStructure
hBmp = CatchImage(Number,ImageLabel)
If hBmp
hDC = StartDrawing(ImageOutput(Number))
If hDC
ImageWidth = ImageWidth(Number) : ImageHeight = ImageHeight(Number) : ImageDepth = ImageDepth(Number)
mem = GlobalAlloc_(#GMEM_FIXED|#GMEM_ZEROINIT,ImageWidth*ImageHeight*4)
If mem
bmi._CTI_BITMAPINFO
bmi\bmiHeader\biSize = SizeOf(BITMAPINFOHEADER)
bmi\bmiheader\biWidth = ImageWidth
bmi\bmiheader\biHeight = ImageHeight
bmi\bmiheader\biPlanes = 1
bmi\bmiheader\biBitCount = ImageDepth
bmi\bmiheader\biCompression = #BI_RGB
If GetDIBits_(hDC,hBmp,0,ImageHeight(Number),mem,bmi,#DIB_RGB_COLORS) <> 0
If TransColor = -1
If ImageDepth=32
*pixels._CTI_LONG = mem+((ImageHeight-1)*ImageWidth*4)
TransColor = *pixels\l
;Debug Hex(TransColor)
ElseIf ImageDepth=16
*pixelsW._CTI_WORD = mem+((ImageHeight-1)*ImageWidth*2)
TransColor2 = *pixelsW\w&$FFFF
;Debug Hex(TransColor2)
EndIf
Else
If ImageDepth=32
TransColor = RGB(Blue(TransColor),Green(TransColor),Red(TransColor))
ElseIf ImageDepth=16
r.l = ((TransColor>>3)&%11111)
g.l = ((TransColor>>6)&%11111100000)
b.l = ((TransColor>>9)&%1111100000000000)
TransColor2 = (r|g|b)&$FFFF
;Debug Hex(TransColor2)
EndIf
EndIf
If NewColor = -1
NewColor = GetSysColor_(#COLOR_BTNFACE) ; #COLOR_WINDOW
EndIf
NewColor = RGB(Blue(NewColor),Green(NewColor),Red(NewColor))
If ImageDepth=32
*pixels._CTI_LONG = mem
For a = 1 To ImageWidth*ImageHeight
If *pixels\l = TransColor
*pixels\l = NewColor
EndIf
*pixels + 4
Next a
ElseIf ImageDepth=16
r = ((NewColor>>3)&%11111)
g = ((NewColor>>6)&%11111100000)
b = ((NewColor>>9)&%1111100000000000)
NewColor2.w = (b|g|r)&$FFFF
*pixelsW._CTI_WORD = mem
For a = 1 To ImageWidth*ImageHeight
If *pixelsW\w&$FFFF = TransColor2
*pixelsW\w = NewColor2
EndIf
*pixelsW + 2
Next a
EndIf
If SetDIBits_(hDC,hBmp,0,ImageHeight(Number),mem,bmi,#DIB_RGB_COLORS) <> 0
Result = hBmp
EndIf
EndIf
GlobalFree_(mem)
EndIf
EndIf
StopDrawing()
EndIf
ProcedureReturn Result
EndProcedure
Procedure.l myCallback(Hwnd.l, uMsg.l, wParam.l, lParam.l)
Select uMsg
Case #WM_ERASEBKGND
ProcedureReturn
Case #WM_PAINT
For i = 1000 To 1002
If IsGadget(i) And Intro = 0
x = GadgetX(i)
y = GadgetY(i)
SetRect_(Rect.RECT, x, y, x + GadgetWidth(i), y + GadgetHeight(i))
ValidateRect_(Hwnd, Rect)
RedrawWindow_(GadgetID(i),0,0,$407)
EndIf
Next
PaintDesktop_(BeginPaint_(Hwnd, ps.PAINTSTRUCT))
EndPaint_(Hwnd, ps)
Case #WM_SIZING,#WM_MOVING
InvalidateRect_(Hwnd, 0, 1)
EndSelect
ProcedureReturn #PB_ProcessPureBasicEvents
EndProcedure
Image1 = CatchTransparentImage(10, ?Image_01, -1, -1)
HwndStartER = OpenWindow(0, 216, 0, 350, 250, "StartER",#PB_Window_ScreenCentered| #PB_Window_WindowCentered)
SetWindowCallback(@myCallback(), 0)
InvalidateRect_(WindowID(0), 0, 1)
CreateGadgetList(WindowID(0))
If ImageGadget(15,0,0,ImageWidth(10),ImageHeight(10),image1)
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
Else
MessageRequester("ERROR","Cant load image!",#MB_ICONERROR)
EndIf
DataSection
Image_01:
IncludeBinary "c:\Canon.bmp"
EndDataSection

Bonne journée