是否可以使用 Clipboard 类从剪贴板中获取所有数据,例如完整的 Skype 引号?他们使用某种我认为的元数据,这就是它如何知道某物何时是引用的。
如何从剪贴板类访问它?我会调用哪些函数来设置/恢复 Skype 报价?
谢谢您的帮助!
Imports System.IO
Imports System.Text
Public Class Form1
Dim locale As New MemoryStream()
Private Sub l() Handles MyBase.Load
Dim strr As New StreamReader(CType(Clipboard.GetData("SkypeMessageFragment"), System.IO.Stream))
locale = Clipboard.GetData("locale")
TextBox1.Text = strr.ReadToEnd()
For Each x In Clipboard.GetDataObject().GetFormats()
'MessageBox.Show("Format " + x + ": " + Clipboard.GetData(x).ToString)
Next
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
Clipboard.Clear()
Clipboard.SetData("SkypeMessageFragment", StreamFromString(TextBox1.Text))
Clipboard.SetData("Text", "testing")
Clipboard.SetData("System.String", "testing")
Clipboard.SetData("UnicodeText", "testing")
Clipboard.SetData("OEMText", "testing")
Clipboard.SetData("locale", locale)
End Sub
Private Shared Function StreamFromString(ByVal s As String) As Stream
Dim encoding As New System.Text.UnicodeEncoding()
Dim mem As New MemoryStream(encoding.GetBytes(s))
Return mem
End Function
End Class