i get result but do not as i want
I will send to you a complete mathod tim
Sub MakeShadowForm(hwnd As Integer, hShadow As Integer, BlurRadius As Integer, iColor As Integer, Contrast As Integer, Opaque As Integer)
'#pragma DisableBackgroundTasks
'#pragma NilObjectChecking
'#pragma StackOverflowChecking
’
Soft Declare Function GetWindowRect Lib “user32” ( hwnd As Integer, lpRect As Ptr ) As Integer
Soft Declare Function GetDC Lib “user32” ( hwnd As Integer ) As Integer
Soft Declare Function CreateCompatibleDC Lib “gdi32” ( hDC As Integer ) As Integer
Soft Declare Function ReleaseDC Lib “user32” ( hwnd As Integer, hDC As Integer ) As Integer
Soft Declare Function CreateDIBSection Lib “gdi32” ( hDC As Integer, pBitmapInfo As Ptr , un As Integer, lplpVoid As Integer, handle As Integer, dw As Integer ) As Integer
Soft Declare Function StretchDIBits Lib “gdi32” ( hDC As Integer, X As Integer, Y As Integer , dx As Integer, dy As Integer, SrcX As Integer, SrcY As Integer, wSrcWidth As Integer, wSrcHeight As Integer, lpBits As Ptr , lpBitsInfo As Ptr, wUsage As Integer, dwRop As Integer ) As Integer
Soft Declare Function SetWindowPos Lib “user32” ( hwnd As Integer, hWndInsertAfter As Integer, X As Integer, Y As Integer, Cx As Integer, Cy As Integer, wFlags As Integer ) As Integer
Soft Declare Function UpdateLayeredWindow Lib “user32.dll” ( hwnd As Integer, hdcDst As Integer, pptDst As Integer , psize As Ptr , hdcSrc As Integer, pptSrc As Ptr , crKey As Integer, pblend As Integer, dwFlags As Integer ) As Integer
Soft Declare Function SelectObject Lib “gdi32” ( hDC As Integer, hObject As Integer ) As Integer
Soft Declare Function DeleteObject Lib “gdi32” ( hObject As Integer ) As Integer
Soft Declare Function DeleteDC Lib “gdi32” ( hDC As Integer ) As Integer
Soft Declare Function SetWindowLong Lib “user32” Alias “SetWindowLongA” ( hwnd As Integer, nIndex As Integer, dwNewLong As Integer ) As Integer
’
Const SWP_NOACTIVATE = &H10
Const DIB_RGB_COLORS = 0
Const ULW_ALPHA = &H2
Const AB_32Bpp255 = 33488896
Const vbSrcCopy = &HCC0020
’
Dim bmpData( 1 , - 1 ) As Byte
ReDim bmpData( BlurRadius * 4 - 1 , BlurRadius - 1 )
Dim sngContrast As Single = Contrast / 100
Dim sngOpaque As Single = Opaque / 100
Dim Index As Integer
For posY As Integer = 0 To BlurRadius - 1
For posX As Integer = 0 To BlurRadius - 1
Dim alpha As Single = ( posX / BlurRadius * posX / BlurRadius + posY / BlurRadius * posY / BlurRadius ) ^ ( 1 / 2 )
If alpha > 1 Then
alpha = 1
ElseIf alpha < 0 Then
alpha = 0
End If
alpha = GetBezier( alpha , sngContrast ) * sngOpaque
bmpData( Index , posY ) = ( ( iColor \ &H10000 ) And &HFF ) * alpha
Index = Index + 1
bmpData( Index , posY ) = ( ( iColor \ &H100 ) And &HFF ) * alpha
Index = Index + 1
bmpData( Index, posY ) = ( iColor And &HFF ) * alpha
Index = Index + 1
bmpData (Index, posY ) = 255 * alpha
Index = Index + 1
Next posX
Index = 0
Next posY
’
Dim X As Integer = UBound( bmpData , 1 ) + 1
Dim Y As Integer = UBound( bmpData , 2 ) + 1
Dim mb As New MemoryBlock( X * Y )
’
For posX As Integer = 0 To X - 1
For posY As Integer = 0 To Y - 1
Dim Offset As Integer = ( posX * posY ) + posX
mb.Byte( Offset ) = bmpData( posX , posY )
mb.Ptr( 0 ) = Nil
Next posY
Next posX
’
Dim Re As New MemoryBlock( 16 )
Call GetWindowRect( hwnd , Re )
Dim Width As Integer = Re.Long( 8 ) - Re.Long( 0 ) + BlurRadius * 2
Dim Height As Integer = Re.Long( 12 ) - Re.Long( 4 ) + BlurRadius * 2
//
Dim bmpInfo As New MemoryBlock( 40 )
bmpInfo.Long( 0 ) = bmpInfo.Size
bmpInfo.Long( 4 ) = Width
bmpInfo.Long( 8 ) = Height
bmpInfo.Short( 12 ) = 1
bmpInfo.Short( 14 ) = 32
'bmpInfo.Long( 16 ) = 0
'bmpInfo.Long( 20 ) = 0
'bmpInfo.Long( 24 ) = 0
'bmpInfo.Long( 28 ) = 0
'bmpInfo.Long( 32 ) = 0
'bmpInfo.Long( 36 ) = 0
’
Dim tmpDC As Integer = GetDC( hwnd )
Dim hDC As Integer = CreateCompatibleDC( tmpDC )
Call ReleaseDC( hwnd , tmpDC )
Dim dib As Integer = CreateDIBSection( hDC , bmpInfo , DIB_RGB_COLORS , 0 , 0 , 0 )
Dim oBmp As Integer = SelectObject( hDC , dib )
//
bmpInfo.Long( 0 ) = bmpInfo.Size
bmpInfo.Long( 4 ) = BlurRadius
bmpInfo.Long( 8 ) = BlurRadius
bmpInfo.Short( 12 ) = 1
bmpInfo.Short( 14 ) = 32
'bmpInfo.Long( 16 ) = 0
'bmpInfo.Long( 20 ) = 0
'bmpInfo.Long( 24 ) = 0
'bmpInfo.Long( 28 ) = 0
'bmpInfo.Long( 32 ) = 0
'bmpInfo.Long( 36 ) = 0
// Draw corners
Call StretchDIBits( hDC, 0 , 0 , BlurRadius , BlurRadius , BlurRadius , 0 , - BlurRadius , BlurRadius , mb , bmpInfo , DIB_RGB_COLORS , vbSrcCopy )
Call StretchDIBits( hDC , 0 , Height - BlurRadius , BlurRadius , BlurRadius , BlurRadius , BlurRadius , - BlurRadius , - BlurRadius , mb , bmpInfo , DIB_RGB_COLORS , vbSrcCopy )
Call StretchDIBits( hDC , Width - BlurRadius , 0 , BlurRadius , BlurRadius , 0 , 0 , BlurRadius , BlurRadius , mb , bmpInfo , DIB_RGB_COLORS , vbSrcCopy )
Call StretchDIBits( hDC , Width - BlurRadius , Height - BlurRadius , BlurRadius , BlurRadius , 0 , BlurRadius , BlurRadius , - BlurRadius , mb , bmpInfo , DIB_RGB_COLORS , vbSrcCopy )
// Draw sides
Call StretchDIBits( hDC , BlurRadius - 1 , 0 , Width - BlurRadius * 2 + 1 , BlurRadius , 0 , 0 , 1 , BlurRadius , mb , bmpInfo , DIB_RGB_COLORS , vbSrcCopy )
Call StretchDIBits( hDC , BlurRadius - 1 , Height - BlurRadius , Width - BlurRadius * 2 + 1 , BlurRadius , 0 , BlurRadius , 1 , - BlurRadius , mb , bmpInfo , DIB_RGB_COLORS , vbSrcCopy )
Call StretchDIBits( hDC , 0 , BlurRadius , BlurRadius , Height - BlurRadius * 2 + 1 , BlurRadius , 0 , - BlurRadius , 1 , mb , bmpInfo , DIB_RGB_COLORS , vbSrcCopy )
Call StretchDIBits( hDC , Width - BlurRadius , BlurRadius , BlurRadius , Height - BlurRadius * 2 + 1 , 0 , 0 , BlurRadius , 1 , mb , bmpInfo , DIB_RGB_COLORS , vbSrcCopy )
'Center
Call StretchDIBits( hDC , BlurRadius - 1 , BlurRadius - 1 , Width - BlurRadius * 2 + 1 , Height - BlurRadius * 2 + 1 , 0 , 0 , 1 , 1 , mb , bmpInfo , DIB_RGB_COLORS , vbSrcCopy )
// Move window
Call SetWindowPos( hShadow , hwnd , Re.Long( 0 ) - BlurRadius , Re.Long( 4 ) - BlurRadius , Width , Height , SWP_NOACTIVATE )
//
Dim Sz As New MemoryBlock( 8 )
Sz.Long( 0 ) = Width
Sz.Long( 4 ) = Height
Dim Pt As New MemoryBlock( 8 )
’
Call UpdateLayeredWindow( hShadow , hDC , 0 , Sz , hDC , Pt , 0 , AB_32Bpp255 , ULW_ALPHA )
'MsgBox "hShadow = " + Str( hShadow ) + " - " + "hDC = " + Str( hDC ) + " - " + "Width = " + Str( Sz.Long( 0 ) ) + " - " + "Height = " + Str( Sz.Long( 4 ) ) + " - " + "Pt = " + Str( Pt.Size )
// Store parameters
Call SetWindowLong( hShadow , 0 , BlurRadius )
Call SetWindowLong( hShadow , 4 , iColor )
Call SetWindowLong( hShadow , 8 , Contrast )
Call SetWindowLong( hShadow , 12 , Opaque )
// Free resources
Call SelectObject( hDC , oBmp )
Call DeleteDC( hDC )
Call DeleteObject( dib )
End Sub
I do not know exactly where the problem !!!
thank you for help me