I was playing around with APIs today, and i stumbed upon code to switch the form backward so the close buttons is on the left no the right. Also i managed to create a see through form that doesn't recieve any input, so you click on the form and it will select what is behind the form.
So i was wondering if there are any other wierd stuff like this out there.
1. backward form
VB Code:
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 Const GWL_EXSTYLE = (-20) Const WS_EX_LAYERED = &H80000 Private Sub Form_Load() Dim ret As Long ret = GetWindowLong(Me.hwnd, GWL_EXSTYLE) ret = ret Or -WS_EX_LAYERED SetWindowLong Me.hwnd, GWL_EXSTYLE, ret End Sub
2. see through unselectable form
VB Code:
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 Sub changeWindow() Dim ret As Long ret = GetWindowLong(Me.hWnd, GWL_EXSTYLE) ret = ret Or WS_EX_LAYERED SetWindowLong Me.hWnd, GWL_EXSTYLE, ret SetLayeredWindowAttributes Me.hWnd, 0, 128, LWA_ALPHA ret = ret Or Not WS_EX_LAYERED SetWindowLong Me.hWnd, GWL_EXSTYLE, ret End Sub Private Sub Form_Load() changeWindow End Sub




Reply With Quote