Thread: umm help

Results 1 to 3 of 3
  1. #1
    braccini8's Avatar
    Join Date
    Dec 2007
    Posts
    640
    Reputation
    11
    Thanks
    36

    umm help

    may someone post the clear background thing for vb6/vb5

    that u place in ur module to make tha background clear

  2. #2
    -TM-'s Avatar
    Join Date
    Dec 2007
    Gender
    male
    Location
    ChairNearDesk
    Posts
    108
    Reputation
    12
    Thanks
    41
    Here you go.

    Code:
    Option Explicit
    
    Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
    Private Declare Function UpdateLayeredWindow Lib "user32" (ByVal hWnd As Long, ByVal hdcDst As Long, pptDst As Any, psize As Any, ByVal hdcSrc As Long, pptSrc As Any, crKey As Long, ByVal pblend As Long, ByVal dwFlags As Long) As Long
    Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
    Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
    
    Private Const GWL_EXSTYLE = (-20)
    Private Const LWA_COLORKEY = &H1
    Private Const LWA_ALPHA = &H2
    Private Const ULW_COLORKEY = &H1
    Private Const ULW_ALPHA = &H2
    Private Const ULW_OPAQUE = &H4
    Private Const WS_EX_LAYERED = &H80000
    
    Public Function MakeTransparent(ByVal hWnd As Long, Perc As Integer) As Long
    Dim Msg As Long
    On Error Resume Next
    If Perc < 0 Or Perc > 255 Then
      MakeTransparent = 1
    Else
      Msg = GetWindowLong(hWnd, GWL_EXSTYLE)
      Msg = Msg Or WS_EX_LAYERED
      SetWindowLong hWnd, GWL_EXSTYLE, Msg
      SetLayeredWindowAttributes hWnd, 0, Perc, LWA_ALPHA
      MakeTransparent = 0
    End If
    If Err Then
      MakeTransparent = 2
    End If
    End Function
    To use have something like this.

    Code:
    Private Sub Form_Load()
    
    MakeTransparent Me.hwnd, 200
    
    End Sub
    Credits to my friend Andrey.
    Last edited by -TM-; 01-11-2008 at 08:33 PM.

  3. The Following User Says Thank You to -TM- For This Useful Post:

    braccini8 (01-11-2008)

  4. #3
    branso's Avatar
    Join Date
    Nov 2007
    Posts
    66
    Reputation
    10
    Thanks
    10
    Or you can use this code

    Const LWA_ALPHA = &H2
    Const GWL_EXSTYLE = (-20)
    Const WS_EX_LAYERED = &H80000
    Public lngresult As Long
    Public Const LWA_COLORKEY = 1
    Option Explicit
    Public Const SWP_NOMOVE = 2
    Public Const SWP_NOSIZE = 1
    Public Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
    Public Const HWND_TOPMOST = -1
    Public Const HWND_NOTOPMOST = -2
    Private m_lngRetVal As Long

    Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
    Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long

    Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long

    Declare Function SetWindowPos Lib "user32" _
    (ByVal hWnd As Long, _
    ByVal hWndInsertAfter As Long, _
    ByVal x As Long, _
    ByVal Y As Long, _
    ByVal cx As Long, _
    ByVal cy As Long, _
    ByVal wFlags As Long) As Long



    Public Sub maketrans()
    lngresult = GetWindowLong(Form1.hWnd, GWL_EXSTYLE)
    lngresult = SetWindowLong(Form1.hWnd, GWL_EXSTYLE, lngresult Or WS_EX_LAYERED)
    SetLayeredWindowAttributes Form1.hWnd, RGB(255, 255, 255), 128, LWA_COLORKEY 'Change the 255, 255, 255 for the background color that ur 'using (here white), so white will be transparent (ALL things that have white 'background).
    End Sub

    Public Sub nomaketrans()
    SetWindowLong Form1.hWnd, GWL_EXSTYLE, WS_EX_LAYERED
    SetLayeredWindowAttributes Form1.hWnd, 255, 255, LWA_ALPHA 'Same Here (U can find LWA_ALPHA on top)
    End Sub

    And in the form this code

    maketrans

Similar Threads

  1. [Help Request] Combat arms Vid help
    By djw111 in forum Combat Arms Help
    Replies: 4
    Last Post: 12-24-2011, 05:06 PM
  2. [Help Request] AFK Bot [help]
    By fet in forum Combat Arms Help
    Replies: 7
    Last Post: 04-28-2011, 03:17 AM
  3. [Help Request] Injector Admin help
    By asdfgas in forum Combat Arms Help
    Replies: 4
    Last Post: 04-27-2011, 06:12 PM
  4. [Help Request] Ajuda / Help
    By - Battery' in forum Combat Arms BR Coding Help
    Replies: 3
    Last Post: 04-22-2011, 07:15 PM
  5. [Help Request] Help my!
    By Windowns7 in forum Combat Arms BR Coding Help
    Replies: 2
    Last Post: 04-18-2011, 01:41 PM