How can i get the form to still respond to user clicks and hoverovers with this code?
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
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 Const GWL_EXSTYLE = (-20)
Private Const WS_EX_LAYERED = &H80000
Private Const LWA_COLORKEY = &H1&
Private Const LWA_ALPHA = &H2&
Public d As Long
Dim i
Dim doa
Private Sub Form_Load()
BackColor = RGB(127, 127, 0) 'Unique but explicit (non-system) color.
Form1.BackColor = BackColor
SetWindowLong hWnd, GWL_EXSTYLE, GetWindowLong(hWnd, GWL_EXSTYLE) Or WS_EX_LAYERED
SetLayeredWindowAttributes hWnd, BackColor, 0, LWA_COLORKEY
End Sub
this code turns the form invisible. But, it makes the mouses cursor change with the things that are behind it.. How do i get it to where the user can click on the form, and everything else when it isn't invisible?
Re: How can i get the form to still respond to user clicks and hoverovers with this c
Something like this?
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
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 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
Private Const GWL_EXSTYLE = (-20)
Private Const WS_EX_LAYERED = &H80000
Private Const WS_EX_TRANSPARENT As Long = &H20&
Private Const LWA_COLORKEY = &H1&
Private Const LWA_ALPHA = &H2&
Private d As Long
Const SWP_NOSIZE = &H1
Const SWP_NOMOVE = &H2
Const SWP_NOACTIVATE = &H10
Const SWP_SHOWWINDOW = &H40
Const HWND_TOPMOST = -1
Const HWND_NOTOPMOST = -2
Dim i, doa, MyStyle As Long
Private Sub Form_Load()
BackColor = RGB(127, 127, 0)
Form1.BackColor = BackColor
SetWindowLong hWnd, GWL_EXSTYLE, GetWindowLong(hWnd, GWL_EXSTYLE) - WS_EX_TRANSPARENT
SetLayeredWindowAttributes hWnd, BackColor, 0, LWA_COLORKEY
FormOnTop Me.hWnd, True
End Sub
Private Sub FormOnTop(hWindow As Long, bTopMost As Boolean)
Dim wFlags As Long, placement As Long
wFlags = SWP_NOMOVE Or SWP_NOSIZE Or SWP_SHOWWINDOW Or SWP_NOACTIVATE
Select Case bTopMost
Case True
placement = HWND_TOPMOST
Case False
placement = HWND_NOTOPMOST
End Select
SetWindowPos hWindow, placement, 0, 0, 0, 0, wFlags
End Sub
Re: How can i get the form to still respond to user clicks and hoverovers with this c
It works, but, i need it to also keep the form hidden. Not show the border around it when clicked and, if there would be a way to have it have no border at all.... im thinking of making a program to where the user can do things on their screen. But, instead, they are doing it to the form....
Re: How can i get the form to still respond to user clicks and hoverovers with this c
Gr8 :)
Do remember to mark the thread resolved ;)
Re: How can i get the form to still respond to user clicks and hoverovers with this c
rofl. i just edited my post. please read it. =)
Re: How can i get the form to still respond to user clicks and hoverovers with this c
If you remove the border, the "Close" button will also go. Then how will you close it? Do you have a control on the form to close the form?
Re: How can i get the form to still respond to user clicks and hoverovers with this c
I am planning on having that on there yes. However, when i make the BorderStyle = none, it does that thing again where the mouse responds to the things underneath the form, and not on the form...
Re: How can i get the form to still respond to user clicks and hoverovers with this c
Do you not have any idea how to stop this?