Hi, I'm trying to make a DLL that makes the windows in mIRC transparent.

I'm using the following code:

Code:
Option Explicit

Const LWA_COLORKEY = &H1
Const LWA_ALPHA = &H2
Const GWL_EXSTYLE = (-20)
Const WS_EX_LAYERED = &H80000
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 Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long

Private mDDEName  As String

Public Function ChangeTrans(ByVal phwnd As Long, pTransLevel As Long) As Long
    Dim lRes    As Long
    Dim Ret     As Long
    'Set the window style to 'Layered'
    Ret = GetWindowLong(phwnd, GWL_EXSTYLE)
    Ret = Ret Or WS_EX_LAYERED
    SetWindowLong phwnd, GWL_EXSTYLE, Ret
    lRes = SetLayeredWindowAttributes(phwnd, 0, pTransLevel, LWA_ALPHA)
    ChangeTrans = lRes
End Function


This code works greate on other forms/window that I make using VB, but as soon is I sent this function the hWnd of one of the windows in mIRC I get:

1) GetWindowLong(phwnd, GWL_EXSTYLE) return 320
2) lRes = SetLayeredWindowAttributes(phwnd, 0, pTransLevel, LWA_ALPHA) returns 0 (which means that it failed)

What am I missing?
(The hWnd I get using $window(@window_name).hwndv , shouldn't the code be working?)


Yeah, I know that there are already DLLs that do it, but I want to code it by myself.(if you can call it that)

Thanks