Convert unicode string (from clipboard) to CP1252 (or other CP) text

417 views Asked by At

I'm trying to outgrow AutoIt for simple programs and write in Visual Basic instead. I have an AutoIt script that converts the Unicode text in the Windows clipboard to text (by default in codepage 1252, but optionally in another codepage), using WideCharToMultiByte. What I can't figure out is how to do the same thing in Visual Basic.

I know how to get the clipboard into a variable:

Dim clpData As String
clpData = (My.Computer.Clipboard.GetText())

What I can't figure out is how to convert that string to non-Unicode (for example codepage 1252) text, and hours of searching didn't come up with an answer, though maybe I'm looking in the wrong places.

I'll be grateful for any help.

0

There are 0 answers