Hallo Leute nochmal,
folgendes Problem:
Bei einer Protokoll-Anzeige haben wir einen Button, der entweder eine Selektion oder einen ganzen Text ins Clipboard speichert.
Da dies HTML-Text inkl. Bilder etc. sein kann, haben wir folgende Funktion:
Klappt soweit gut, doch leider werden Umlaute nicht richtig erkannt. Leider ist es nicht möglich eine Funktion zu machen, welche diese umwandelt. Dies haben wir bereits versucht, doch bei diversen Emails etc. hat dies zu Problemen geführt.
Das Problem ist, wenn normal Ctrl+C benutzt wird, klappen sowohl die Umlaute als auch die Bilder etc., daher muss es irgendwie möglich sein, dies sauber hinzukriegen.
Wie immer vielen Dank im VOraus.
folgendes Problem:
Bei einer Protokoll-Anzeige haben wir einen Button, der entweder eine Selektion oder einen ganzen Text ins Clipboard speichert.
Da dies HTML-Text inkl. Bilder etc. sein kann, haben wir folgende Funktion:
Code:
Public Sub PutHTMLClipboard(sHtmlFragment As String)
On Error Resume Next
Me.MousePointer = vbHourglass
If RegisterCF <> 0 Then
Const sContextStart = "<HTML><BODY>"
Const sContextEnd = "</BODY></HTML>"
Dim sData As String
' 'Build the HTML given the description, the fragment and the context.
' 'And, replace the offset place holders in the description with values
' 'for the offsets of StartHMTL, EndHTML, StartFragment and EndFragment.
sData = m_sDescription & sContextStart & sHtmlFragment & sContextEnd
sData = Replace(sData, "aaaaaaaaaa", _
Format$(Len(m_sDescription), "0000000000")) 'MLHIDE
sData = Replace(sData, "bbbbbbbbbb", Format$(Len(sData), "0000000000")) 'MLHIDE
sData = Replace(sData, "cccccccccc", Format$(Len(m_sDescription & _
sContextStart), "0000000000")) 'MLHIDE
sData = Replace(sData, "dddddddddd", Format$(Len(m_sDescription & _
sContextStart & sHtmlFragment), "0000000000")) 'MLHIDE
'Add the HTML code to the clipboard
If CBool(OpenClipboard(0)) Then
Dim hMemHandle As Long, lpData As Long
hMemHandle = GlobalAlloc(0, Len(sData) + 10)
If CBool(hMemHandle) Then
lpData = GlobalLock(hMemHandle)
If lpData <> 0 Then
CopyMemory ByVal lpData, ByVal sData, Len(sData)
GlobalUnlock hMemHandle
EmptyClipboard
SetClipboardData m_cfHTMLClipFormat, hMemHandle
End If
End If
Call CloseClipboard
End If
End If
Me.MousePointer = vbNormal
End Sub
Klappt soweit gut, doch leider werden Umlaute nicht richtig erkannt. Leider ist es nicht möglich eine Funktion zu machen, welche diese umwandelt. Dies haben wir bereits versucht, doch bei diversen Emails etc. hat dies zu Problemen geführt.
Das Problem ist, wenn normal Ctrl+C benutzt wird, klappen sowohl die Umlaute als auch die Bilder etc., daher muss es irgendwie möglich sein, dies sauber hinzukriegen.
Wie immer vielen Dank im VOraus.