first of all im sorry for bringing up an old topicCode: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 Dim nhwnd As Int32 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim p As New System.Diagnostics.Process p = Process.Start("notepad") p.WaitForInputIdle() nhwnd = p.MainWindowHandle.ToInt32 TrackBar1.Maximum = 255 TrackBar1.Value = 100 End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Transparency(nhwnd, 100) 'Set transparency to 100, or anywhere between 0-255. Use a trackbar if you want. End Sub Private Sub Transparency(ByVal hwnd As Int32, ByVal sOpacity As Int32) Dim Ret As Int32 = apiGetWindowLong(hwnd, GWL_EXSTYLE) 'Set the window style to 'Layered' Ret = Ret Or WS_EX_LAYERED apiSetWindowLong(hwnd, GWL_EXSTYLE, Ret) apiSetLayeredWindowAttributes(hwnd, 0, sOpacity, LWA_ALPHA) 'Set the opacity of the layered window 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
im new at vb and rly dont know how to do this with an already started application
could somebody rewrite it to make it work with and already started application?




Reply With Quote