VB Code:
  1. Option Explicit
  2.  
  3. Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
  4. Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
  5. 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
  6. Private Const WS_EX_TRANSPARENT = &H20&
  7. Private Const GWL_EXSTYLE = (-20)
  8. Private Const SWP_NOMOVE = &H2
  9. Private Const SWP_NOSIZE = &H1
  10. Private Const SWP_FRAMECHANGED = &H20        '  The frame changed: send WM_NCCALCSIZE
  11.  
  12. Public Sub MakeFrameTransparent(ByVal fraThis As Frame)
  13.  
  14. Dim lExStyle As Long
  15.  
  16. lExStyle = GetWindowLong(fraThis.hwnd, GWL_EXSTYLE)
  17. lExStyle = lExStyle Or WS_EX_TRANSPARENT
  18.  
  19. Call SetWindowLong(fraThis.hwnd, GWL_EXSTYLE, lExStyle)
  20. Call SetWindowPos(fraThis.hwnd, 0, 0, 0, 0, 0, SWP_NOMOVE + SWP_NOSIZE + SWP_FRAMECHANGED)
  21.  
  22. End Sub

Note that you can make other windows transparent as well - the effect with a rich text box is particularily pleasing....

HTH,
Duncan