Here is my code, All I get evey time I copy a unicode character to the clipboard then come here is a "?" in the textt, "3F" in hex, and "63" decimal. What's wrong? What's right?
Code:
Option Explicit
Private Sub Form_Load()
If App.PrevInstance = True Then
MsgBox "Application already running!"
End
End If
Me.Caption = App.Title
Call SimulateOptionClick
End Sub
Private Sub Form_GotFocus()
Call SimulateOptionClick
End Sub
Private Sub mnuFileExit_Click()
End
End Sub
Private Sub Option1_Click(Index As Integer)
ShowClipboardContents (Index)
End Sub
Private Sub SimulateOptionClick()
Dim X As Long
For X = 0 To Option1.UBound
If Option1(X).Value = True Then
Call ShowClipboardContents(X)
End If
Next
End Sub
Private Sub ShowClipboardContents(ByVal Format As Integer)
Dim strData As String, strRes As String, strChar As String, strUni As String
Dim bytArray() As Byte
Dim X As Long
bytArray = Clipboard.GetText
'strData = Clipboard.GetText
Select Case Format
Case 0 'Text
strRes = CStr(bytArray)
Case 1 'Hex
For X = 0 To UBound(bytArray)
strRes = strRes & Hex(bytArray(X)) & " "
Next
strRes = Replace(strRes, " 0", "") 'There's a 0 between every value for some reason
Case 2 'Decimal
For X = 0 To UBound(bytArray)
strRes = strRes & bytArray(X) & " "
Next
strRes = Replace(strRes, " 0", "") 'There's a 48 between every value for some reason
Case 3 'Binary
strRes = "Binary is not yet functional..."
End Select
Text1.Text = strRes
End Sub
' strRes = ""
' For X = 1 To Len(strData)
'strChar = Mid(strData, X, 1)
'strUni = StrConv(strChar, vbFromUnicode)
'strUni = strChar
'strRes = strRes & strUni ' & " "
'Next
I've tried it with both Arial Unicode MS and Lucidia Sans Unicode
Unicode questions are few on this forum, but answers are like virtually noexistent. PLEASE HELP
Visual Basic uses Unicode to store and manipulate strings. Unicode is a character set where 2 bytes are used to represent each character. Some other programs, such as the Windows 95 API, use ANSI (American National Standards Institute) or DBCS to store and manipulate strings. When you move strings outside of Visual Basic, you may encounter differences between Unicode and ANSI/DBCS. The following table shows the ANSI, DBCS, and Unicode character sets in different environments.
Environment Character set(s) used
Visual Basic Unicode
32-bit object libraries Unicode
16-bit object libraries ANSI and DBCS
Windows NT API Unicode
Automation in Windows NT Unicode
Windows 95 API ANSI and DBCS
Automation in Windows 95 Unicode
ANSI
ANSI is the most popular character standard used by personal computers. Because the ANSI standard uses only a single byte to represent each character, it is limited to a maximum of 256 character and punctuation codes. Although this is adequate for English, it doesn't fully support many other languages.
DBCS
DBCS is used in Microsoft Windows systems that are distributed in most parts of Asia. It provides support for many different East Asian language alphabets, such as Chinese, Japanese, and Korean. DBCS uses the numbers 0 – 128 to represent the ASCII character set. Some numbers greater than 128 function as lead-byte characters, which are not really characters but simply indicators that the next value is a character from a non-Latin character set. In DBCS, ASCII characters are only 1 byte in length, whereas Japanese, Korean, and other East Asian characters are 2 bytes in length.
Unicode
Unicode is a character-encoding scheme that uses 2 bytes for every character. The International Standards Organization (ISO) defines a number in the range of 0 to 65,535 (216 – 1) for just about every character and symbol in every language (plus some empty spaces for future growth). On all 32-bit versions of Windows, Unicode is used by the Component Object Model (COM), the basis for OLE and ActiveX technologies. Unicode is fully supported by Windows NT. Although both Unicode and DBCS have double-byte characters, the encoding schemes are completely different
Well I understood most of that already, but it still doesn't help me. I can't get unicode characters to display at all in VB. I copy them to the clipboard using Charachter Map and then I can't paste em into VB and see anything but '?'.
I saw your post about vb printing "?" when trying to access a unicode character from clipboard. I am having a similar problem. I am loading chinese characters from access 2000. It reads in access 2000 just fine in unicode, but when I retreive the character into vb it displays "??" I have tried all sorts of reseach, but can't find anything. I was hoping that maybe you can shed some light on the situation. [email protected]