Public Function WindowProc(ByVal hwnd As Long, ByVal iMsg As Long, _ ByVal wParam As Long, ByVal lParam As Long) As Long Dim sItem As String Select Case iMsg Case WM_DRAWCLIPBOARD ' Get clipboard text and put it into text box sItem = PasteTextFromClipboard If sItem <> " " Then frmClipViewer.txtCurrent = sItem If sItem <> " " And bAddToList Then ' Add item to listbox cItems = cItems + 1 frmClipViewer.lstItems.AddItem sItem, 0 ' If exceeded maximum, remove last item If cItems > MAX_ITEMS Then frmClipViewer.lstItems.RemoveItem MAX_ITEMS - 1 cItems = cItems - 1 End If ' Select item If frmClipViewer.lstItems.ListCount >= 1 Then frmClipViewer.lstItems.Selected(0) = True End If ' Update label frmClipViewer.lblItemCount = cItems & " items" End If ' Send message to next clipboard viewer If hNextViewer <> 0 Then SendMessage hNextViewer, WM_DRAWCLIPBOARD, wParam, lParam End If Exit Function Case WM_CHANGECBCHAIN |