Add Horizontal Scroll bar to Listboxes

VB Code:
  1. 'PUT IN MODULE...
  2. Public Const LB_SETHORIZONTALEXTENT = &H194
  3. Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
  4.  
  5. Public Sub HorizontalSbar(List1 As ListBox)
  6.  
  7. Dim lngReturn As Long
  8. Dim lngExtent As Long
  9.  
  10. lngExtent = 2 * (List1.Width / Screen.TwipsPerPixelX)   'Set the Horizontal Bar to 2 times its Width
  11.  
  12. lngReturn = SendMessage(List1.hwnd, LB_SETHORIZONTALEXTENT, lngExtent, 0&)
  13. End Sub
  14.  
  15. 'USAGE:
  16. 'Call HorizontalSbar(LISTBOX_NAME_HERE)

Move Form With No Border
VB Code:
  1. Private Declare Function ReleaseCapture Lib "user32" () As Long
  2. Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
  3.  
  4. Public Sub DragForm(frm As Form)
  5.     ReleaseCapture
  6.     Call SendMessage(frm.hwnd, &HA1, 2, 0&)
  7. End Sub
  8.  
  9. 'USAGE:
  10. 'Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X 'As Single, Y As Single)
  11. 'DragForm Me
  12. 'End Sub

Transparent Form
VB Code:
  1. Option Explicit
  2. Private Declare Function CreateRectRgn Lib _
  3.     "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, _
  4.     ByVal X2 As Long, ByVal Y2 As Long) As Long
  5. Private Declare Function CombineRgn Lib _
  6.     "gdi32" (ByVal hDestRgn As Long, ByVal hSrcRgn1 As Long, _
  7.     ByVal hSrcRgn2 As Long, ByVal nCombineMode As Long) As Long
  8. Private Declare Function SetWindowRgn Lib _
  9.     "user32" (ByVal hWnd As Long, ByVal hRgn As Long, _
  10.     ByVal bRedraw As Boolean) As Long
  11. Private Declare Function DeleteObject Lib _
  12.     "gdi32" (ByVal hObject As Long) As Long
  13.  
  14. ' Constants used by the CombineRgn function
  15. Private Const RGN_AND = 1
  16. Private Const RGN_OR = 2
  17. Private Const RGN_XOR = 3
  18. Private Const RGN_DIFF = 4
  19. Private Const RGN_COPY = 5
  20.  
  21. Private Sub Form_Activate()
  22.     Dim rgnForm As Long, rgnCombined As Long
  23.     Dim rgnControl As Long, x As Long
  24.     Dim formWidth As Single, formHeight As Single
  25.     Dim borderWidth As Single, titleHeight As Single
  26.     Dim ctlLeft As Single, ctlTop As Single
  27.     Dim ctlWidth As Single, ctlHeight As Single
  28.     Dim ctl As Control
  29.  
  30.     ' Calculate the form area
  31.     borderWidth = (Me.Width - Me.ScaleWidth) / 2
  32.     titleHeight = Me.Height - Me.ScaleHeight - borderWidth
  33.     ' Convert to Pixels
  34.     borderWidth = ScaleX(borderWidth, vbTwips, vbPixels)
  35.     titleHeight = ScaleY(titleHeight, vbTwips, vbPixels)
  36.     formWidth = ScaleX(Me.Width, vbTwips, vbPixels)
  37.     formHeight = ScaleY(Me.Height, vbTwips, vbPixels)
  38.    
  39.     ' Create a region for the whole form
  40.     rgnForm = CreateRectRgn(0, 0, formWidth, formHeight)
  41.    
  42.     rgnCombined = CreateRectRgn(0, 0, 0, 0)
  43.     ' Make the graphical area transparent by combining the two regions
  44.     x = CombineRgn(rgnCombined, rgnForm, rgnForm, RGN_DIFF)
  45.  
  46.     ' Make the controls visible
  47.     For Each ctl In Controls
  48.         ' Make the regions of controls whose container is the form visible
  49.         If TypeOf ctl.Container Is Form Then
  50.             ctlLeft = ScaleX(ctl.Left, vbTwips, vbPixels) + borderWidth
  51.             ctlTop = ScaleX(ctl.Top, vbTwips, vbPixels) + titleHeight
  52.             ctlWidth = ScaleX(ctl.Width, vbTwips, vbPixels) + ctlLeft
  53.             ctlHeight = ScaleX(ctl.Height, vbTwips, vbPixels) + ctlTop
  54.             rgnControl = CreateRectRgn(ctlLeft, ctlTop, ctlWidth, ctlHeight)
  55.             x = CombineRgn(rgnCombined, rgnCombined, rgnControl, RGN_OR)
  56.         End If
  57.     Next ctl
  58.    
  59.  
  60.     ' Set the clipping area of the window using the resulting region
  61.     SetWindowRgn hWnd, rgnCombined, True
  62.     ' Tidy up
  63.     x = DeleteObject(rgnCombined)
  64.     x = DeleteObject(rgnControl)
  65.     x = DeleteObject(rgnForm)
  66. End Sub

:-)