Results 1 to 2 of 2

Thread: Still looking for help with transparent window

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2002
    Posts
    3

    Still looking for help with transparent window

    I posted for help earlier and got no replies

    I need a transparent form/frame/user control/etc thats located over a video window. Then I want to draw in the transparent window on top of the video(lines etc) using the mouse.

    Here is something similar that joaquim posted back in Nov 2008..

    http://www.vbforums.com/showthread.p...ht=transparent

    Interesting idea...but a little messy due to the mouse events not being accurate on the transparent user control.

    I have tried many things and searched high and low without success.

    Is this really that hard to do or even impossible in VB6?

    Thanks for any help!

  2. #2
    Fanatic Member
    Join Date
    Mar 2009
    Posts
    739

    Re: Still looking for help with transparent window

    I wrote an image grabber many years ago. It had a frame and a transparent background. The idea was that you'd place the frame over something on your display, position and size the frame until you were happy and then 'click' to make a copy of whatever was in the frame.

    This worked great for years on W2000 and XP but when Vista arrived it stopped working - maybe something to do with Aero.

    Anyway, I think I did something like this but it probably won't work on vista/aero although I didn't bother looking for a reason - maybe I'll do it one day.

    Code:
    ' before calling this function set your form background to vbRed and the
    ' call to SetLayeredWindowAttributes makes that red into transparent.
    
    
    Public Function SetBackground()
    Dim rtn As Long
       
       On Error GoTo errPoint
       rtn = GetWindowLong(hwnd, GWL_EXSTYLE)
       rtn = rtn Or WS_EX_LAYERED
       SetWindowLong hwnd, GWL_EXSTYLE, rtn
       SetLayeredWindowAttributes hwnd, vbRed, 255, 1 ' LWA_ALPHA
       
    Exit Function
    errPoint:
        
        ' probably running windows9x so doesn't support the LayeredWindowAttributes
        Err.Clear
    
    End Function
    Last edited by IanS; Apr 24th, 2010 at 12:56 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width