New topic: 

UpdateLayeredWindows dont show nothing

<http://forums.realsoftware.com/viewtopic.php?t=45632>

         Page 1 of 1
   [ 1 post ]                 Previous topic | Next topic          Author  
Message        josemym2          Post subject: UpdateLayeredWindows dont show 
nothingPosted: Thu Oct 18, 2012 4:58 am                         
Joined: Fri Jul 20, 2012 10:29 pm
Posts: 5                Hello, I translate a VB6 code to realbasic for change 
the windows form, to an alpha channel picture.

But when i compile, don´t show any error, and don´t show nothing.

Please could you help me?

This is my code in FORM > OPEN.

#If TargetWin32
  'AlphaFormat flags
  Const AC_SRC_OVER  = &H0
  Const AC_SRC_ALPHA = &H1
  
  Const ULW_COLORKEY  = &H1
  Const ULW_ALPHA  = &H2
  Const ULW_OPAQUE  = &H4
  
  Const GWL_EXSTYLE = -20
  Const WS_EX_LAYERED = &H80000
  
  Const DIB_RGB_COLORS  = 0
  
  dim sizeZX as size
  sizeZX.cx=me.Width
  sizeZX.cy=me.Height
  
  
  Dim memDC As Integer, memBitmap As Integer, bmHeader As BITMAPINFOHEADER
  
  
  Declare Function UpdateLayeredWindow Lib "user32" (ByVal hwnd As Integer, 
ByVal hdcDst As Integer, ByVal pptDst As Integer, ByRef psize As Size, ByVal 
hdcSrc As Integer, pptSrc As Currency, ByVal crKey As Integer, ByRef pBlend As 
BlendFunc, ByVal dwFlags As Integer) As Integer
  
  Declare Function CreateDIBSection Lib "gdi32" (ByVal hdc As Integer, 
pBitmapInfo As BITMAPINFOHEADER, ByVal un As Integer, lplpVoid As Integer, 
ByVal handle As Integer, ByVal dw As Integer) As Integer
  
  Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Integer) As 
Integer
  Declare Function SelectObject Lib "gdi32" (ByVal hdc As Integer, ByVal 
hObject As Integer) As Integer
  Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal 
hwnd As Integer, ByVal nIndex As Integer) As Integer
  Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal 
hwnd As Integer, ByVal nIndex As Integer, ByVal dwNewLong As Integer) As Integer
  Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Integer) As 
Integer
  Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Integer) As Integer
  
  
  dim ret as integer
  ret = SetWindowLong (Me.Handle, GWL_EXSTYLE, GetWindowLong(Me.Handle, 
GWL_EXSTYLE) Or WS_EX_LAYERED)
  
  
  Dim blend As blendFunc
  blend.AlphaFormat = AC_SRC_ALPHA//AC_SRC_OVER
  blend.SourceConstantAlpha = 255
  blend.BlendFlags = 0
  blend.BlendOp = AC_SRC_OVER
  
  memDC = CreateCompatibleDC(Me.Handle)
  memBitmap = CreateDIBSection(memDC, bmHeader, DIB_RGB_COLORS,  0, 0, 0)
  ret = DeleteObject (SelectObject(memDC, memBitmap))
  
  dim pic as Picture
  pic = DibujaGraphics()
  
  'dim thePtr as Ptr = pic.CopyOSHandle( Picture.HandleType.WindowsBMP )
  'memDC = integer(thePtr)
  
  'Dim ptrBlock as MemoryBlock
  'ptrBlock = new MemoryBlock(4)
  'ptrBlock.Long(0) = thePtr
  'memdc = ptrBlock.Ptr(0)
  
  
  dim g as Graphics
  g=pic.Graphics
  g.DrawPicture(pic,0,0)
  memdc=g.Handle(Graphics.HandleTypeHDC)
  
  
  ret = UpdateLayeredWindow (Me.Handle, 0, 0, sizeZX, memdc, 0, 0, blend, 
ULW_ALPHA)
  
  ret = DeleteObject (memBitmap)
  ret = DeleteObject (memDC)
#EndIf


What is wrong, please?   
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 1 post ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to