[API]
WideCharToMultiByte

[CODE]
Public Function OEMEncode(ByVal xChar1 As String) As String
  Dim xLong1 As Long
  Dim xLong2 As Long
  Dim xChar2 As String

  xLong1 = Len(xChar1)
  If Not xLong1 = 0& Then
    xLong2 = WideCharToMultiByte(1&, 0&, ByVal StrPtr(xChar1), xLong1, ByVal 0&, 0&, ByVal 0&, ByVal 0&)
    If Not xLong2 = 0& Then
      xChar2 = String(xLong2, vbNullChar) '+1?
      xLong1 = WideCharToMultiByte(1&, 0&, ByVal StrPtr(xChar1), xLong1, ByVal xChar2, xLong2, ByVal 0&, ByVal 0&)
      If xLong1 = xLong2 Then
        OEMEncode = xChar2
        End If
      End If
    End If
  End Function
