Japt

CueBanner - VB.NET

Jul 18th, 2016
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. Imports System.ComponentModel
  2. Imports System.Runtime.InteropServices
  3.  
  4. '------------------
  5. 'Creator: aeonhack
  6. 'Site: elitevs.net
  7. 'Created: 10/15/2011
  8. 'Changed: 10/15/2011
  9. 'Version: 1.0.0
  10. '------------------
  11. <ProvideProperty("CueBanner", GetType(TextBox))> _
  12. Class CueBanner
  13. Inherits Component
  14. Implements IExtenderProvider
  15.  
  16. <DllImport("user32.dll", CharSet:=CharSet.Auto, EntryPoint:="SendMessage")>
  17. Private Shared Function SetCueBanner(
  18. ByVal handle As IntPtr,
  19. ByVal message As UInteger,
  20. ByVal wparam As IntPtr,
  21. ByVal hint As String) As IntPtr
  22. End Function
  23.  
  24. Private children As New Hashtable
  25. Private Function CanExtend(ByVal c As Object) As Boolean Implements IExtenderProvider.CanExtend
  26. If Not TypeOf c Is TextBox Then Return False
  27.  
  28. If Not children.Contains(c) Then
  29. children.Add(c, String.Empty)
  30. HookCreation(DirectCast(c, TextBox))
  31. End If
  32.  
  33. Return True
  34. End Function
  35.  
  36. Private Sub HandleCreated(ByVal s As Object, ByVal e As EventArgs)
  37. SetBanner(DirectCast(s, TextBox))
  38. End Sub
  39.  
  40. Function GetCueBanner(ByVal c As TextBox) As String
  41. Return DirectCast(children(c), String)
  42. End Function
  43. Sub SetCueBanner(ByVal c As TextBox, ByVal v As String)
  44. children(c) = v
  45.  
  46. HookCreation(c)
  47. SetBanner(c)
  48. End Sub
  49.  
  50. Private Sub HookCreation(ByVal c As TextBox)
  51. RemoveHandler c.HandleCreated, AddressOf HandleCreated
  52. AddHandler c.HandleCreated, AddressOf HandleCreated
  53. End Sub
  54.  
  55. Private Sub SetBanner(ByVal c As TextBox)
  56. If Not c.IsHandleCreated Then Return
  57. SetCueBanner(c.Handle, 5377, IntPtr.Zero, GetCueBanner(c))
  58. End Sub
  59.  
  60. End Class
Add Comment
Please, Sign In to add comment