Private Declare Function CreatePalette Lib "gdi32" (lpLogPalette As LOGPALETTE) As Long
Private Declare Function AnimatePalette Lib "gdi32" Alias "AnimatePaletteA" (ByVal hPalette As Long, ByVal wStartIndex As Long, ByVal wNumEntries As Long, lpPaletteColors As PALETTEENTRY) As Long
Private Declare Function SelectPalette Lib "gdi32" (ByVal hdc As Long, ByVal hPalette As Long, ByVal bForceBackground As Long) As Long
Private Declare Function RealizePalette Lib "gdi32" (ByVal hdc As Long) As Long
Private Type PALETTEENTRY
peRed As Byte
peGreen As Byte
peBlue As Byte
peFlags As Byte
End Type
Private Type LOGPALETTE
palVersion As Integer
palNumEntries As Integer
palPalEntry(255) As PALETTEENTRY
End Type
Const PC_RESERVED = &H1 ' palette index used for animation
Private Sub Command1_Click()
Dim hPAL As Long
Dim PAL As LOGPALETTE
Dim a As Long
Dim LPTemp As LOGPALETTE
PAL.palVersion = &H300
PAL.palNumEntries = 1
For b = 0 To 255
PAL.palPalEntry(b).peRed = 255 - b
PAL.palPalEntry(b).peGreen = 255 - b
PAL.palPalEntry(b).peBlue = 255 - b
PAL.palPalEntry(b).peFlags = PC_RESERVED
Next
LPTemp.palPalEntry(0).peRed = PAL.palPalEntry(0).peRed
LPTemp.palPalEntry(0).peGreen = PAL.palPalEntry(0).peGreen
LPTemp.palPalEntry(0).peBlue = PAL.palPalEntry(0).peBlue
LPTemp.palPalEntry(0).peFlags = PAL.palPalEntry(0).peFlags
hPAL = CreatePalette(PAL)
a = SelectPalette(Picture1.hdc, hPAL, False)
a = RealizePalette(Picture1.hdc)
Text1.Text = a
AnimatePalette hPAL, 0, 1, LPTemp.palPalEntry(0)
End Sub
在run時,它顯示了以下的畫面:
RUN-TIME ERROR"453"
Can't find dll entry ponit AnimatePaletteA in gdi32
接著我按debug時,它就指示是"AnimatePalette hPAL, 0, 1, LPTemp.palPalEntry(0)"發生錯誤,究竟我這句裡發生了甚麼問題,會不會是因為RealizePalette(Picture1.hdc)的a=0,而導至這個問題發生呢?
我是使用WINDOWS 98SE(中文)