VBA, MS Access MS Access в примерах

Перекодирование строки в CP 866 и обратно в WIN 1251 (API)

По материалам : http://www.sql.ru/forum/

Public Declare PtrSafe Function OemToChar Lib "user32" Alias "OemToCharA" (ByVal StrFrom As String, ByVal StrTo As String) As Long
Public Declare PtrSafe Function CharToOem Lib "user32" Alias "CharToOemA" (ByVal lpszSrc As String, ByVal lpszDst As String) As Long

Public Function OEM2ANSI(ByVal sOem As String) As String
    Dim sAnsi As String
    sAnsi = String(Len(sOem), Chr(0))
    OemToChar sOem, sAnsi
    OEM2ANSI = sAnsi
End Function
Public Function ANSI2OEM(ByVal sAnsi As String) As String
    Dim sOem As String
    sOem = String(Len(sAnsi), Chr(0))
    CharToOem sAnsi, sOem
    ANSI2OEM = sOem
End Function

Назад ToTop
L.E. 15.01.2020
Рейтинг@Mail.ru