Seite 1 von 1

[PureBasic 4.20 B2] POLINK-Error bei AlphaBlend

Verfasst: 22.03.2008 12:13
von legion
Hallo !

Mir ist aufgefallen, dass einige alte Programme die "AlphaBlend" aus der
"Msimg32.lib" nutzen nicht mehr funktionieren. :cry:

Beim Start kommt der Fehler:
POLINK:error:Unresolved external symbol '_AlphaBlend'.

Lg. Legion


Beispiel funktioniert bis PB4.02 ohne Probleme:

Code: Alles auswählen

Import "Msimg32.lib" 
  AlphaBlend(dc1, x1, y1, w1, h1, dc2, x2, y2, w2, h2, blend) 
EndImport 

Global blend.l

*blend.BLENDFUNCTION = @blend 
*blend\SourceConstantAlpha = 128

Procedure.l DrawAlphaImage2(hdc, image, x, y, Alpha) 
  TempDC = CreateCompatibleDC_(hdc) 
  If TempDC 
    object = SelectObject_(TempDC, ImageID(image)) 
    If object 
      w = ImageWidth(image) 
      h = ImageHeight(image) 
       
      AlphaBlend(hdc, x, y, w, h, TempDC, 0, 0, w, h, blend) 
      DeleteObject_(object) 
    EndIf 
    DeleteDC_(TempDC) 
  EndIf 
EndProcedure 

For i = 1 To 10 
  If CreateImage(i, Random(50)+50, Random(50)+50) 
    If StartDrawing(ImageOutput(i)) 
      Box(0, 0, ImageWidth(i), ImageHeight(i), RGB(Random(255), Random(255), Random(255))) 
      StopDrawing() 
    EndIf 
  EndIf 
Next i 

If OpenWindow(0, 0, 0, 400, 300, "AlphaBlend", #PB_Window_SystemMenu|#PB_Window_ScreenCentered) 
  
  WinHDC = StartDrawing(WindowOutput(0)) 
  
  If WinHDC 
    For i = 1 To 100 
      For j = 1 To 10 
        DrawAlphaImage2(WinHDC, j, Random(375), Random(275), i) 
      Next j 
      WindowEvent() 
      Delay(20) 
    Next i 
  EndIf 
  
  StopDrawing() 

  Repeat 
  Until WaitWindowEvent()=#PB_Event_CloseWindow 

EndIf