danka

Member | Редактировать | Профиль | Сообщение | ICQ | Цитировать | Сообщить модератору Нашел в сети по моей проблемме. Но это решение мне не подходит,т.к. у меня английская винда, а там написано что : Данные функции работают корректно только на русской Windows Решил выложить. Может кому понадобиться ... Как изменить кодировку 'Форма Text1.Text = Convert(Text1.Text, 866, 1251) 'dos->win Text1.Text = Convert(Text1.Text, 1251, 866) 'win->dos Text1.Text = Convert(Text1.Text, 28595, 1251) 'iso->win Text1.Text = Convert(Text1.Text, 1251, 28595) 'win->iso Text1.Text = Convert(Text1.Text, 20866, 1251) 'koi8r->win Text1.Text = Convert(Text1.Text, 20866, 1251) 'win->koi8r 'Модуль Declare Function MultiByteToWideChar& Lib "kernel32" (ByVal CodePage As Long, _ ByVal dwFlags As Long, ByVal lpMultiByteStr As String, ByVal cchMultiByte As _ Long, ByVal lpWideCharStr As Long, ByVal cchWideChar As Long) Declare Function WideCharToMultiByte& Lib "kernel32" (ByVal CodePage As Long, _ ByVal dwFlags As Long, ByVal lpWideCharStr As Long, ByVal cchWideChar As Long, _ ByVal lpMultiByteStr As String, ByVal cchMultiByte As Long, ByVal lpDefaultChar _ As String, ByVal lpUsedDefaultChar As Long) ' MBCS and Unicode Translation Flags. Public Const MB_PRECOMPOSED = &H1 ' use precomposed chars Public Const MB_COMPOSITE = &H2 ' use composite chars Public Const MB_USEGLYPHCHARS = &H4 ' use glyph chars, not ctrl chars Public Function Convert(ByVal strSrc As String, ByVal nFromCP As Long, ByVal nToCP As Long) As String Dim nLen As Long Dim strDst As String Dim strRet As String Dim nRet As Long nLen = Len(strSrc) strDst = String(nLen * 2, Chr(0)) strRet = String(nLen * 2, Chr(0)) nRet = MultiByteToWideChar(nFromCP, MB_PRECOMPOSED, strSrc, nLen, strDst, nLen) nRet = WideCharToMultiByte(nToCP, 0, strDst, nRet, strRet, nLen * 2, ByVal 0, 0) Convert = Left(strRet, nRet) End Function |