Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
2.0 KiB

  1. ��Imports EnvDTE
  2. Imports System.Diagnostics
  3. '
  4. ' This module contains macros that only work in vs2005 or later.
  5. '
  6. Public Module Valve2005
  7. Class ClipboardCopier
  8. Sub DoCopy()
  9. Dim t As System.Threading.Thread = New System.Threading.Thread(AddressOf MyThreadFunction)
  10. t.SetApartmentState(System.Threading.ApartmentState.STA)
  11. t.Start()
  12. t.Join() ' Wait for the thread to finish.
  13. End Sub
  14. Sub MyThreadFunction()
  15. Dim x As String
  16. x = System.Windows.Forms.Clipboard.GetText()
  17. System.Windows.Forms.Clipboard.SetText(x)
  18. End Sub
  19. End Class
  20. Sub CopyToClipboardAsPlainText()
  21. ' First have the app copy stuff to the clipboard.
  22. DTE.ExecuteCommand("Edit.Copy")
  23. ' Now convert the clipboard contents to plain text.
  24. ' Must do this inside a thread with a state that .net likes.
  25. Dim cc As New ClipboardCopier
  26. cc.DoCopy()
  27. End Sub
  28. End Module