Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as VB.Net by NitroX ( 17 years ago )
Public Class Form1
    Const LWA_COLORKEY As Int32 = 1
    Const LWA_ALPHA As Int32 = 2
    Const GWL_EXSTYLE As Int32 = (-20)
    Const WS_EX_LAYERED As Int32 = 524288
    Private Declare Function apiGetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Int32, ByVal nIndex As Int32) As Int32
    Private Declare Function apiSetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Int32, ByVal nIndex As Int32, ByVal dwNewLong As Int32) As Int32
    Private Declare Function apiSetLayeredWindowAttributes Lib "user32" Alias "SetLayeredWindowAttributes" (ByVal hWnd As Int32, ByVal crKey As Int32, ByVal bAlpha As Byte, ByVal dwFlags As Int32) As Int32
    Private Declare Function apiFindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Int32

    Dim nhwnd As Int32 = 0

    Private Declare Function SHChangeNotify Lib "Shell32.dll" (ByVal wEventID As Int32, ByVal uFlags As Int32, ByVal dwItem1 As Int32, ByVal dwItem2 As Int32) As Int32
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        TrackBar1.Maximum = 255
        TrackBar1.Value = 100
        nhwnd = apiFindWindow(Nothing, "sro_client")

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Transparency(nhwnd, 100)
    End Sub

    Private Sub Transparency(ByVal hwnd As Int32, ByVal sOpacity As Int32)
        Dim Ret As Int32 = apiGetWindowLong(hwnd, GWL_EXSTYLE)
        Ret = Ret Or WS_EX_LAYERED
        apiSetWindowLong(hwnd, GWL_EXSTYLE, Ret)
        apiSetLayeredWindowAttributes(hwnd, 0, sOpacity, LWA_ALPHA)
    End Sub

    Private Sub TrackBar1_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar1.Scroll
        Transparency(nhwnd, TrackBar1.Value)

    End Sub
End Class

 

Revise this Paste

Your Name: Code Language: