Hello,
I need to make a form completely transparent.
for example, when you maximize it, you can only see the title bar,
I still need it to be there, but it just cant be visible.
thanks,
Dennis
Printable View
Hello,
I need to make a form completely transparent.
for example, when you maximize it, you can only see the title bar,
I still need it to be there, but it just cant be visible.
thanks,
Dennis
I know I can find the DC of the desktop, then blit that onto my form, and it would look transparent but I would like to see if there is another way before I attemp that.
Code:'make a form transparent
'put this code in a bas module
Option Explicit
Public Const GWL_EXSTYLE = (-20)
Public Const WS_EX_TRANSPARENT = &H20&
Public Const SWP_FRAMECHANGED = &H20
Public Const SWP_NOMOVE = &H2
Public Const SWP_NOSIZE = &H1
Public Const SWP_SHOWME = SWP_FRAMECHANGED Or _
SWP_NOMOVE Or SWP_NOSIZE
Public Const HWND_NOTOPMOST = -2
Declare Function SetWindowLong Lib "user32" _
Alias "SetWindowLongA" _
(ByVal hwnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
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
' <<<< Form Code >>>>
Option Explicit
'you must set the Form's [ShowInTaskbar to false]
'you must set the Form's [BorderStyle to none]
'
'
Private Sub Command1_Click()
SetWindowLong Me.hwnd, GWL_EXSTYLE, _
WS_EX_TRANSPARENT
SetWindowPos Me.hwnd, HWND_NOTOPMOST, _
0&, 0&, 0&, 0&, SWP_SHOWME
End Sub
Thank you very much!
this was exactly what I was looking for!