• Vui lòng đọc nội qui diễn đàn để tránh bị xóa bài viết
  • Tìm kiếm trước khi đặt câu hỏi

Tổng hợp Unicode trong VB6

Các bài viết hướng dẫn, giúp các bạn hiểu và tiếp cận với Visual Basic nhanh hơn
baohiep
Thành viên danh dự
Thành viên danh dự
Bài viết: 109
Ngày tham gia: CN 27/12/2009 6:37 pm
Đến từ: Tam Kỳ
Has thanked: 3 time
Been thanked: 9 time

Tổng hợp Unicode trong VB6

Gửi bàigửi bởi baohiep » T.Sáu 20/01/2012 12:14 pm

Tên bài viết: Tổng hợp Unicode trong VB6
Tác giả: Lê Bảo Hiệp
Cấp độ bài viết: Chưa đánh giá
Tóm tắt: Tổng hợp các bài viết về Unicode trong 4rum



Clipboard Unicode:
Bài cUniClipboard:
http://caulacbovb.com/forum/viewtopic.php?f=36&t=15436
Tác giả: doicanhden

Tạo một Module Class tên cClipboard:
  1. Public Enum Clipboard_Format
  2.      CF_TEXT = 1
  3.      CF_BITMAP = 2
  4.      CF_METAFILEPICT = 3
  5.      CF_SYLK = 4
  6.      CF_DIF = 5
  7.      CF_TIFF = 6
  8.      CF_OEMTEXT = 7
  9.      CF_DIB = 8
  10.      CF_PALETTE = 9
  11.      CF_PENDATA = 10
  12.      CF_RIFF = 11
  13.      CF_WAVE = 12
  14.      CF_UNICODETEXT = 13
  15.      CF_ENHMETAFILE = 14
  16.      CF_HDROP = 15
  17.      CF_LOCALE = 16
  18.      CF_MAX = 17
  19.      CF_OWNERDISPLAY = 128
  20.      CF_DSPTEXT = 129
  21.      CF_DSPBITMAP = 130
  22.      CF_DSPMETAFILEPICT = 131
  23.      CF_DSPENHMETAFILE = 142
  24.      CF_PRIVATEFIRST = 512
  25.      CF_PRIVATELAST = 767
  26.      CF_GDIOBJFIRST = 768
  27.      CF_GDIOBJLAST = 1023
  28. End Enum
  29. Private Enum GlobalMemory
  30.     GMEM_DDESHARE = &H2000
  31.     GMEM_DISCARDABLE = &H100
  32.     GMEM_DISCARDED = &H4000
  33.     GMEM_FIXED = &H0
  34.     GMEM_INVALID_HANDLE = &H8000
  35.     GMEM_LOCKCOUNT = &HFF
  36.     GMEM_MODIFY = &H80
  37.     GMEM_MOVEABLE = &H2
  38.     GMEM_NOCOMPACT = &H10
  39.     GMEM_NODISCARD = &H20
  40.     GMEM_NOT_BANKED = &H1000
  41.     GMEM_NOTIFY = &H4000
  42.     GMEM_SHARE = &H2000
  43.     GMEM_VALID_FLAGS = &H7F72
  44.     GMEM_ZEROINIT = &H40
  45.     GMEM_LOWER = GMEM_NOT_BANKED
  46.     GPTR = (GMEM_FIXED Or GMEM_ZEROINIT)
  47.     GHND = (GMEM_MOVEABLE Or GMEM_ZEROINIT)
  48. End Enum
  49. Public Enum FileEffectConstants
  50.   EffectCopy = 1
  51.   EffectMove = 2
  52. End Enum
  53. Private Type POINTAPI
  54.    X As Long
  55.    y As Long
  56. End Type
  57. Private Type DROPFILES
  58.    pFiles As Long
  59.    pt As POINTAPI
  60.    fNC As Long
  61.    fWide As Long
  62. End Type
  63.  
  64. Private Declare Function RegisterClipboardFormat Lib "User32" Alias "RegisterClipboardFormatW" (ByVal lpString As Long) As Long
  65. Private Declare Function IsClipboardFormatAvailable Lib "User32" (ByVal wFormat As Long) As Long
  66. Private Declare Function EnumClipboardFormats Lib "User32" (ByVal wFormat As Long) As Long
  67. Private Declare Function CountClipboardFormats Lib "User32" () As Long
  68. Private Declare Function GetClipboardFormatName Lib "User32" Alias "GetClipboardFormatNameW" (ByVal wFormat As Long, ByVal lpString As Long, ByVal nMaxCount As Long) As Long
  69. Private Declare Function OpenClipboard Lib "User32" (ByVal hwnd As Long) As Long
  70. Private Declare Function EmptyClipboard Lib "User32" () As Long
  71. Private Declare Function SetClipboardData Lib "User32" (ByVal wFormat As Long, ByVal hMem As Long) As Long
  72. Private Declare Function GetClipboardData Lib "User32" (ByVal wFormat As Long) As Long
  73. Private Declare Function CloseClipboard Lib "User32" () As Long
  74. Private Declare Function GlobalAlloc Lib "Kernel32" (ByVal wFlags As GlobalMemory, ByVal dwBytes As Long) As Long
  75. Private Declare Function GlobalFree Lib "Kernel32" (ByVal hMem As Long) As Long
  76. Private Declare Function GlobalLock Lib "Kernel32" (ByVal hMem As Long) As Long
  77. 'Private Declare Function GlobalReAlloc Lib "Kernel32" (ByVal hMem As Long, ByVal dwBytes As Long, ByVal wFlags As Long) As Long
  78. Private Declare Function GlobalSize Lib "Kernel32" (ByVal hMem As Long) As Long
  79. Private Declare Function GlobalUnlock Lib "Kernel32" (ByVal hMem As Long) As Long
  80. Private Declare Sub CopyMemory Lib "Kernel32" Alias "RtlMoveMemory" (lpvDest As Any, lpvSource As Any, ByVal cbCopy As Long)
  81. Private Declare Function LongStringCopy Lib "Kernel32" Alias "lstrcpyW" (ByVal lpString1 As Long, ByVal lpString2 As Long) As Long
  82. Private Declare Function StrLen Lib "Kernel32" Alias "lstrlenW" (ByVal Ptr As Long) As Long
  83. Private Declare Function DragQueryFile Lib "Shell32" Alias "DragQueryFileW" (ByVal hDrop As Long, ByVal UINT As Long, ByVal lpStr As Long, ByVal ch As Long) As Long
  84. Public Function SetText(ByVal sText$) As Boolean
  85.     Dim sPtr&, iLen&, iLock&
  86.     On Error GoTo LabExit
  87.     iLen = LenB(sText) + 2
  88.     sPtr = GlobalAlloc(GHND, iLen)
  89.     iLock = GlobalLock(sPtr)
  90.     Call LongStringCopy(iLock, StrPtr(sText))
  91.     Call GlobalUnlock(sPtr)
  92.     If OpenClipboard(0&) Then
  93.         Call EmptyClipboard
  94.         Call SetClipboardData(CF_UNICODETEXT, sPtr)
  95.         Call CloseClipboard
  96.         SetText = True
  97.     End If
  98. LabExit:
  99. End Function
  100. Public Function GetText() As String
  101.     Dim lPtr&, lLenght&, lMemH&, sData$
  102.     If OpenClipboard(0&) Then
  103.         lPtr = GetClipboardData(CF_UNICODETEXT)
  104.         lMemH = GlobalLock(lPtr)
  105.         lLenght = GlobalSize(lPtr)
  106.         sData = String$(lLenght \ 2 - 1, Chr(0))
  107.         Call LongStringCopy(StrPtr(sData), lMemH)
  108.         Call GlobalUnlock(lPtr)
  109.         Call CloseClipboard
  110.         GetText = sData
  111.     End If
  112. End Function
  113. Public Function Clear() As Boolean
  114.     If OpenClipboard(0&) Then
  115.         Call EmptyClipboard
  116.         Call CloseClipboard
  117.         Clear = True
  118.     End If
  119. End Function
  120. Public Function GetFiles(Optional ByRef iFileCount As Long, Optional ByRef lEffect As FileEffectConstants) As String() 'Tra ve 1 mang chua danh sach cac tap tin
  121.   Dim hDrop&, lFormat&, hGlobal&, iFile&, sFileName$, iPos&, sFiles$()
  122.     On Error GoTo LabExit
  123.     If OpenClipboard(0&) Then
  124.         lFormat = RegisterClipboardFormat(StrPtr("Preferred DropEffect")) 'Get ID
  125.       hDrop = GetClipboardData(CF_HDROP)
  126.         hGlobal = GetClipboardData(lFormat) 'For Effect
  127.       Call CloseClipboard
  128.     End If
  129.     If (hDrop <> 0) Then
  130.         iFileCount = DragQueryFile(hDrop, -1&, StrPtr(""), 0&)
  131.         If (iFileCount > 0) Then
  132.             ReDim sFiles(1 To iFileCount) As String
  133.             sFileName = String$(260, Chr(0))
  134.             For iFile = 1 To iFileCount
  135.                 Call DragQueryFile(hDrop, iFile - 1, StrPtr(sFileName), Len(sFileName))
  136.                 iPos = InStr(sFileName, vbNullChar)
  137.                 If (iPos <> 0) Then
  138.                     sFiles(iFile) = Left$(sFileName, iPos - 1)
  139.                 Else
  140.                     sFiles(iFile) = sFileName
  141.                 End If
  142.                 GetFiles = sFiles
  143.                 ReDim sFiles(0)
  144.             Next iFile
  145.             If (hGlobal <> 0) Then
  146.                 Call CopyMemory(lEffect, ByVal hGlobal, 4) 'For Effect
  147.           End If
  148.         End If
  149.     End If
  150. LabExit:
  151. End Function
  152. Public Function SetFiles(ByRef sFiles() As String, Optional ByVal lEffect As FileEffectConstants = EffectCopy) As Boolean
  153.     Dim i&, sData$, hMemH&, hMemH2&
  154.     Dim DF As DROPFILES
  155.     Dim B() As Byte
  156.     Dim lFormat&
  157.     On Error GoTo LabExit
  158.     For i = LBound(sFiles) To UBound(sFiles)
  159.         sData = sData & sFiles(i) & vbNullChar
  160.     Next i
  161.     sData = sData & vbNullChar
  162.     DF.pFiles = Len(DF) ' Size of Structure: 20 bytes
  163.   DF.fWide = 1 ' 0 To ASCII; 1 To Unicode
  164.   lFormat = RegisterClipboardFormat(StrPtr("Preferred DropEffect")) ' Get ID
  165.   hMemH = GlobalAlloc(GHND, Len(DF) + LenB(sData))
  166.     hMemH2 = GlobalAlloc(GHND, 4) ' For Effect
  167.   hMemH = GlobalLock(hMemH)
  168.     hMemH2 = GlobalLock(hMemH2) ' For Effect
  169.   Call CopyMemory(ByVal hMemH, DF, Len(DF))
  170.     Call CopyMemory(ByVal (hMemH + Len(DF)), ByVal StrPtr(sData), LenB(sData))
  171.     Call CopyMemory(ByVal hMemH2, lEffect, 4) ' For Effect
  172.   Call GlobalUnlock(hMemH)
  173.     Call GlobalUnlock(hMemH2) ' For Effect
  174.   If OpenClipboard(0&) Then
  175.         Call EmptyClipboard
  176.         Call SetClipboardData(CF_HDROP, hMemH)
  177.         Call SetClipboardData(lFormat, hMemH2) ' For Effect
  178.       Call CloseClipboard
  179.         SetFiles = True
  180.     End If
  181. LabExit:
  182. End Function
  183. Public Function GetFormat(ByVal lFormat As Long) As Boolean
  184.     GetFormat = CBool(IsClipboardFormatAvailable(lFormat))
  185. End Function
  186. Public Function AddFormat(ByVal sName As String) As Long
  187.     Dim wFormat&
  188.     wFormat = RegisterClipboardFormat(StrPtr(sName & Chr$(0)))
  189.     If (wFormat > &HC000&) Then AddFormat = wFormat
  190. End Function
  191. Public Function GetBinaryData(ByVal lFormat As Long) As Byte()
  192.     Dim hMemH&, lSize&, lClipboard&, bTemp() As Byte
  193.     If CBool(IsClipboardFormatAvailable(lFormat)) Then
  194.         If OpenClipboard(0&) Then
  195.             lClipboard = GetClipboardData(lFormat)
  196.             lSize = GlobalSize(lClipboard)
  197.             If lSize > 0 Then
  198.                 hMemH = GlobalLock(lClipboard)
  199.                 ReDim bTemp(0 To lSize - 1)
  200.                 Call CopyMemory(bTemp(0), ByVal hMemH, ByVal lSize)
  201.                 Call GlobalUnlock(lClipboard)
  202.                 GetBinaryData = bTemp
  203.                 ReDim bTemp(0)
  204.             End If
  205.             Call CloseClipboard
  206.         End If
  207.     End If
  208. End Function
  209. Public Function SetBinaryData(ByRef bData() As Byte, ByVal lFormat As Long) As Boolean
  210.     Dim lSize&, lPtr&, hMemH&
  211.     lSize = UBound(bData) - LBound(bData) + 1
  212.     hMemH = GlobalAlloc(GHND, lSize)
  213.     If (hMemH <> 0) Then
  214.         lPtr = GlobalLock(hMemH)
  215.         CopyMemory ByVal lPtr, bData(LBound(bData)), lSize
  216.         Call GlobalUnlock(hMemH)
  217.         If OpenClipboard(0&) Then
  218.             Call SetClipboardData(lFormat, hMemH)
  219.             Call CloseClipboard
  220.             SetBinaryData = True
  221.         End If
  222.     End If
  223. End Function
  224. Public Function FormatCount() As Long
  225.     FormatCount = CountClipboardFormats()
  226. End Function
  227. Public Function ListNameFormat(Optional ByRef lListCount As Long) As String()
  228.     'Lay Danh Sach Ten Cac Dinh Dang Ton Tai Tren Clipboard
  229.   Dim lR&, i&, sName$()
  230.     If (OpenClipboard(0&)) Then
  231.         lR = EnumClipboardFormats(0)
  232.         If (lR <> 0) Then
  233.             Do
  234.                 ReDim Preserve sName(i)
  235.                 sName(i) = FormatName(lR)
  236.                 sName(i) = IIf(sName(i) = vbNullString, "[Unknow]", sName(i))
  237.                 lR = EnumClipboardFormats(lR)
  238.                 i = i + 1
  239.             Loop While lR <> 0
  240.         End If
  241.         Call CloseClipboard
  242.         lListCount = i - 1
  243.         ListNameFormat = sName
  244.     End If
  245. End Function
  246. Public Function ListIDFormat(Optional ByRef lListCount As Long) As Long()
  247.     'Lay Danh Sach ID Cac Dinh Dang Ton Tai Tren Clipboard
  248.   Dim lR&, i&, lID&()
  249.     If (OpenClipboard(0&)) Then
  250.         lR = EnumClipboardFormats(0)
  251.         If (lR <> 0) Then
  252.             Do
  253.                 ReDim Preserve lID(i)
  254.                 lID(i) = lR
  255.                 lR = EnumClipboardFormats(lR)
  256.                 i = i + 1
  257.             Loop While lR <> 0
  258.         End If
  259.         Call CloseClipboard
  260.         lListCount = i - 1
  261.         ListIDFormat = lID
  262.     End If
  263. End Function
  264. Public Function FormatName(ByVal lFormatID As Long) As String
  265.     Dim lSize&, lR&, sTmp$
  266.     If (lFormatID >= 1 And lFormatID <= 17) Then
  267.         Select Case lFormatID
  268.         Case CF_TEXT
  269.             sTmp = "Text"
  270.         Case CF_BITMAP
  271.             sTmp = "Bitmap Picture"
  272.         Case CF_METAFILEPICT
  273.             sTmp = "Meta-File Picture"
  274.         Case CF_SYLK
  275.             sTmp = "Microsoft Symbolic Link (SYLK) data."
  276.         Case CF_DIF
  277.            sTmp = "Software Arts"
  278.         Case CF_TIFF
  279.             sTmp = "Tagged Image File Format (TIFF) Picture"
  280.         Case CF_OEMTEXT
  281.             sTmp = "Text (OEM)"
  282.         Case CF_DIB
  283.             sTmp = "DIB Bitmap Picture"
  284.         Case CF_PALETTE
  285.             sTmp = "Colour Palette"
  286.         Case CF_PENDATA
  287.             sTmp = "Pen Data"
  288.         Case CF_RIFF
  289.             sTmp = "RIFF Audio data"
  290.         Case CF_WAVE
  291.             sTmp = "Wave File"
  292.         Case CF_UNICODETEXT
  293.             sTmp = "Text (Unicode)"
  294.         Case CF_ENHMETAFILE
  295.             sTmp = "Enhanced Meta-File Picture"
  296.          Case CF_HDROP
  297.             sTmp = "File List"
  298.         Case CF_LOCALE
  299.             sTmp = "Text Locale Identifier"
  300.         End Select
  301.     Else
  302.         sTmp = String$(255, 0)
  303.         lR = GetClipboardFormatName(lFormatID, StrPtr(sTmp), 255)
  304.         If (lR <> 0) Then
  305.             sTmp = Left$(sTmp, lR)
  306.         End If
  307.     End If
  308.     FormatName = sTmp
  309. End Function


Khai báo trong Form:
[vb]Dim Clipboard As New cClipboard[/vb]

Download:
http://caulacbovb.com/forum/download/file.php?id=11094

Tạo Form có tiêu đề Tiếng Việt:
Bài Tạo tiêu đề Form Tiếng Việt đơn giản:
http://caulacbovb.com/forum/viewtopic.php?t=14402
Tác giả: pctester2020

Thêm vào Form:
[vb]'Unicode cho Title cua Form
Private Declare Function DefWindowProcW Lib "user32" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long

Public Sub SetUniFormCaption(ByVal hWnd As Long, ByVal sUniText As String)
'---------------------------------------------------------------------------------------
' Function : SetUniFormCaption (Unicode TitleBar, Frame, Button, CheckBox, Option)
' Author : thuongall@yahoo.com
' Address : Dong Khoi
'---------------------------------------------------------------------------------------

DefWindowProcW hWnd, &HC, &H0&, StrPtr(sUniText) 'WM_SETTEXT=&HC
End Sub

Public Function Telex2Uni(ByVal TelexStr As String) As String ' Chuyen chuoi go theo kieu Telex thanh chuoi tieng Viet Unicode
'---------------------------------------------------------------------------------------
' Function : Telex2Uni
' Author : phantronghiep07
' Phone : 0915 080 282
'---------------------------------------------------------------------------------------
Dim i As Integer
Dim MaAcii, Telex

MaAcii = Array(7845, 7847, 7849, 7851, 7853, 226, 225, 224, 7843, 227, 7841, 7855, 7857, 7859, _
7861, 7863, 259, 250, 249, 7911, 361, 7909, 7913, 7915, 7917, 7919, 7921, 432, _
7871, 7873, 7875, 7877, 7879, 234, 233, 232, 7867, 7869, 7865, 7889, 7891, 7893, _
7895, 7897, 244, 243, 242, 7887, 245, 7885, 7899, 7901, 7903, 7905, 7907, 417, _
237, 236, 7881, 297, 7883, 253, 7923, 7927, 7929, 7925, 273, 7844, 7846, 7848, _
7850, 7852, 194, 193, 192, 7842, 195, 7840, 7854, 7856, 7858, 7860, 7862, 258, _
218, 217, 7910, 360, 7908, 7912, 7914, 7916, 7918, 7920, 431, 7870, 7872, 7874, _
7876, 7878, 202, 201, 200, 7866, 7868, 7864, 7888, 7890, 7892, 7894, 7896, 212, _
211, 210, 7886, 213, 7884, 7898, 7900, 7902, 7904, 7906, 416, 205, 204, 7880, 296, _
7882, 221, 7922, 7926, 7928, 7924, 272)

Telex = Array("aas", "aaf", "aar", "aax", "aaj", "aa", "as", "af", "ar", "ax", "aj", "aws", "awf", _
"awr", "awx", "awj", "aw", "us", "uf", "ur", "ux", "uj", "uws", "uwf", "uwr", "uwx", _
"uwj", "uw", "ees", "eef", "eer", "eex", "eej", "ee", "es", "ef", "er", "ex", "ej", _
"oos", "oof", "oor", "oox", "ooj", "oo", "os", "of", "or", "ox", "oj", "ows", "owf", _
"owr", "owx", "owj", "ow", "is", "if", "ir", "ix", "ij", "ys", "yf", "yr", "yx", "yj", _
"dd", "AAS", "AAF", "AAR", "AAX", "AAJ", "AA", "AS", "AF", "AR", "AX", _
"AJ", "AWS", "AWF", "AWR", "AWX", "AWJ", "AW", "US", "UF", "UR", "UX", _
"UJ", "UWS", "UWF", "UWR", "UWX", "UWJ", "UW", "EES", "EEF", "EER", _
"EEX", "EEJ", "EE", "ES", "EF", "ER", "EX", "EJ", "OOS", "OOF", "OOR", _
"OOX", "OOJ", "OO", "OS", "OF", "OR", "OX", "OJ", "OWS", "OWF", "OWR", _
"OWX", "OWJ", "OW", "IS", "IF", "IR", "IX", "IJ", "YS", "YF", "YR", "YX", _
"YJ", "DD")

Telex2Uni = TelexStr
For i = 0 To 133
Telex2Uni = Replace(Telex2Uni, Telex(i), ChrW(MaAcii(i)))
Next i
Telex2Uni = Replace(Telex2Uni, "'", "") ' Neu muon hien thi ko dau thi phai go ky tu ' . Vd: Vi'sual Ba'sic
End Function[/vb]

Sử dụng:
[vb]Private Sub Form_Load()
'Go tieng viet kieu Telex
SetUniFormCaption Me.hWnd, Telex2Uni("Vis duj hieern thij Tieesng Vieejt treen tieeu ddeef Fo'rm")
End Sub[/vb]

Tạo Menu Tiếng Việt:
Bài 1 dòng code = 1 menu đã việt hóa! OK!:
http://caulacbovb.com/forum/viewtopic.php?f=36&t=2011
Tác giả: zZ_Shine_Zz

Tạo Module tên modMenu:
[vb]Option Explicit

'============================================
' Ban co the gui bat ki y kien nao ve dia chi
' gambo_cd3000@yahoo.com
' thanks
'============================================

'============================================
'() () {{___________}} |Author: Tran The Huy
'(^ _ ^) {{ I LOVE AN }} |Ver: 1.00
'_______ {{___________}} |Mail: gambo_cd3000@yahoo.com
'============================================

Public Declare Function AppendMenu Lib "user32" Alias "AppendMenuA" (ByVal hMenu As Long, ByVal wFlags As Long, ByVal wIDNewItem As Long, ByVal lpNewItem As Any) As Long

Public Declare Function GetMenu Lib "user32" (ByVal hwnd As Long) As Long
Public Declare Function GetMenuItemCount Lib "user32" (ByVal hMenu As Long) As Long
Public Declare Function GetMenuString Lib "user32" Alias "GetMenuStringA" (ByVal hMenu As Long, ByVal wIDItem As Long, ByVal lpString As String, ByVal nMaxCount As Long, ByVal wFlag As Long) As Long
Public Declare Function GetMenuItemID Lib "user32" (ByVal hMenu As Long, ByVal nPos As Long) As Long
Public Declare Function GetSubMenu Lib "user32" (ByVal hMenu As Long, ByVal nPos As Long) As Long

Public Declare Function SetMenuItemInfo Lib "user32" Alias "SetMenuItemInfoW" (ByVal hMenu As Long, ByVal un As Long, ByVal BOOL As Boolean, lpcMenuItemInfo As MENUITEMINFO) As Long
Public Declare Function GetMenuItemInfo Lib "user32" Alias "GetMenuItemInfoA" (ByVal hMenu As Long, ByVal un As Long, ByVal b As Long, lpMenuItemInfo As MENUITEMINFO) As Long
Public Declare Function SetMenuItemBitmaps Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long, ByVal hBitmapUnchecked As Long, ByVal hBitmapChecked As Long) As Long

Public Type MENUITEMINFO
cbSize As Long
fMask As Long
fType As Long
fState As Long
wID As Long
hSubMenu As Long
hbmpChecked As Long
hbmpUnchecked As Long
dwItemData As Long
dwTypeData As Long
cch As Long
hbmpItem As Long
End Type

Public Const MF_BITMAP = &H4&
Public Const MF_STRING = &H0&

Public Sub ToUniMenu(ByVal hwnd As Long)
Dim hMenu As Long, sMenu As Long, ItemID As Long, CountItem As Long
Dim AdsMenu As New clsArrayVar, AdItemPos As New clsArrayVar
Dim j As Long, k As String * 100, mInfo As MENUITEMINFO
Dim fc As Long

With mInfo
.cbSize = Len(mInfo): .fType = &H200: .fMask = &H10
End With

hMenu = GetMenu(hwnd)
CountItem = GetMenuItemCount(hMenu)

For j = 0 To CountItem - 1
AdsMenu.AddItem hMenu
AdItemPos.AddItem j
Next

Do While CountItem > 0

ItemID = GetMenuItemID(AdsMenu.List(0), AdItemPos.List(0))

If ItemID = -1 Then

ItemID = GetSubMenu(AdsMenu.List(0), AdItemPos.List(0))
fc = GetMenuItemCount(ItemID)
CountItem = CountItem + fc

For j = 0 To fc - 1
AdsMenu.AddItem ItemID
AdItemPos.AddItem j
Next

End If

GetMenuString AdsMenu.List(0), ItemID, k, 50, 0

mInfo.dwTypeData = StrPtr(ToUni(k))

SetMenuItemInfo AdsMenu.List(0), AdItemPos.List(0), 1, mInfo

SetMenuItemBitmaps AdsMenu.List(0), ItemID, 0, frmMain.Picture1.Picture.Handle, frmMain.Picture2.Picture.Handle

CountItem = CountItem - 1
AdItemPos.RemoveItem 0
AdsMenu.RemoveItem 0
fc = -1
Loop
End Sub[/vb]

Tạo Module tên modUniTextVer3:
[vb]Option Explicit
'Version: 3.00. Upgrade by : Tran The Huy

Public Function ToUniByVNI(ByVal sText As String)
Dim i As Integer, j As Integer
Dim sCurChar As String, sPreChar As String, sPreTxt As String
For j = 1 To 2
For i = 2 To Len(sText)
sCurChar = Mid(sText, i, 1)
sPreTxt = Left(sText, i - 2)
sPreChar = Mid(sText, i - 1, 1)
Select Case sCurChar
Case "1"
Select Case sPreChar
'a
Case "a": sText = sPreTxt & ChrW$(&HE1) & Right(sText, Len(sText) - i)
Case "A": sText = sPreTxt & ChrW$(&HC1) & Right(sText, Len(sText) - i)
Case ChrW$(&HE2): sText = sPreTxt & ChrW$(&H1EA5) & Right(sText, Len(sText) - i)
Case ChrW$(&HC2): sText = sPreTxt & ChrW$(&H1EA4) & Right(sText, Len(sText) - i)
Case ChrW$(&H103): sText = sPreTxt & ChrW$(&H1EAF) & Right(sText, Len(sText) - i)
Case ChrW$(&H102): sText = sPreTxt & ChrW$(&H1EAE) & Right(sText, Len(sText) - i)

'e
Case "e": sText = sPreTxt & ChrW$(&HE9) & Right(sText, Len(sText) - i)
Case "E": sText = sPreTxt & ChrW$(&HC9) & Right(sText, Len(sText) - i)
Case ChrW$(&HEA): sText = sPreTxt & ChrW$(&H1EBF) & Right(sText, Len(sText) - i)
Case ChrW$(&HCA): sText = sPreTxt & ChrW$(&H1EBE) & Right(sText, Len(sText) - i)

'i
Case "i": sText = sPreTxt & ChrW$(&HED) & Right(sText, Len(sText) - i)
Case "I": sText = sPreTxt & ChrW$(&HCD) & Right(sText, Len(sText) - i)

'o
Case "o": sText = sPreTxt & ChrW$(&HF3) & Right(sText, Len(sText) - i)
Case "O": sText = sPreTxt & ChrW$(&HD3) & Right(sText, Len(sText) - i)
Case ChrW$(&HF4): sText = sPreTxt & ChrW$(&H1ED1) & Right(sText, Len(sText) - i)
Case ChrW$(&HD4): sText = sPreTxt & ChrW$(&H1ED0) & Right(sText, Len(sText) - i)
Case ChrW$(&H1A1): sText = sPreTxt & ChrW$(&H1EDB) & Right(sText, Len(sText) - i)
Case ChrW$(&H1A0): sText = sPreTxt & ChrW$(&H1EDA) & Right(sText, Len(sText) - i)

'u
Case "u": sText = sPreTxt & ChrW$(&HFA) & Right(sText, Len(sText) - i)
Case "U": sText = sPreTxt & ChrW$(&HDA) & Right(sText, Len(sText) - i)
Case ChrW$(&H1B0): sText = sPreTxt & ChrW$(&H1EE9) & Right(sText, Len(sText) - i)
Case ChrW$(&H1AF): sText = sPreTxt & ChrW$(&H1EE8) & Right(sText, Len(sText) - i)

'y
Case "y": sText = sPreTxt & ChrW$(&HFD) & Right(sText, Len(sText) - i)
Case "Y": sText = sPreTxt & ChrW$(&HDD) & Right(sText, Len(sText) - i)

End Select

Case "2"
Select Case sPreChar
'a
Case "a": sText = sPreTxt & ChrW$(&HE0) & Right(sText, Len(sText) - i)
Case "A": sText = sPreTxt & ChrW$(&HC0) & Right(sText, Len(sText) - i)
Case ChrW$(&HE2): sText = sPreTxt & ChrW$(&H1EA7) & Right(sText, Len(sText) - i)
Case ChrW$(&HC2): sText = sPreTxt & ChrW$(&H1EA6) & Right(sText, Len(sText) - i)
Case ChrW$(&H103): sText = sPreTxt & ChrW$(&H1EB1) & Right(sText, Len(sText) - i)
Case ChrW$(&H102): sText = sPreTxt & ChrW$(&H1EB0) & Right(sText, Len(sText) - i)

'e
Case "e": sText = sPreTxt & ChrW$(&HE8) & Right(sText, Len(sText) - i)
Case "E": sText = sPreTxt & ChrW$(&HC8) & Right(sText, Len(sText) - i)
Case ChrW$(&HEA): sText = sPreTxt & ChrW$(&H1EC1) & Right(sText, Len(sText) - i)
Case ChrW$(&HCA): sText = sPreTxt & ChrW$(&H1EC0) & Right(sText, Len(sText) - i)

'i
Case "i": sText = sPreTxt & ChrW$(&HEC) & Right(sText, Len(sText) - i)
Case "I": sText = sPreTxt & ChrW$(&HCC) & Right(sText, Len(sText) - i)

'o
Case "o": sText = sPreTxt & ChrW$(&HF2) & Right(sText, Len(sText) - i)
Case "O": sText = sPreTxt & ChrW$(&HD2) & Right(sText, Len(sText) - i)
Case ChrW$(&HF4): sText = sPreTxt & ChrW$(&H1ED3) & Right(sText, Len(sText) - i)
Case ChrW$(&HD4): sText = sPreTxt & ChrW$(&H1ED2) & Right(sText, Len(sText) - i)
Case ChrW$(&H1A1): sText = sPreTxt & ChrW$(&H1EDD) & Right(sText, Len(sText) - i)
Case ChrW$(&H1A0): sText = sPreTxt & ChrW$(&H1EDC) & Right(sText, Len(sText) - i)

'u
Case "u": sText = sPreTxt & ChrW$(&HF9) & Right(sText, Len(sText) - i)
Case "U": sText = sPreTxt & ChrW$(&HD9) & Right(sText, Len(sText) - i)
Case ChrW$(&H1B0): sText = sPreTxt & ChrW$(&H1EEB) & Right(sText, Len(sText) - i)
Case ChrW$(&H1AF): sText = sPreTxt & ChrW$(&H1EEA) & Right(sText, Len(sText) - i)

'y
Case "y": sText = sPreTxt & ChrW$(&H1EF3) & Right(sText, Len(sText) - i)
Case "Y": sText = sPreTxt & ChrW$(&H1EF2) & Right(sText, Len(sText) - i)

End Select

Case "3"
Select Case sPreChar
'a
Case "a": sText = sPreTxt & ChrW$(&H1EA3) & Right(sText, Len(sText) - i)
Case "A": sText = sPreTxt & ChrW$(&H1EA2) & Right(sText, Len(sText) - i)
Case ChrW$(&HE2): sText = sPreTxt & ChrW$(&H1EA9) & Right(sText, Len(sText) - i)
Case ChrW$(&HC2): sText = sPreTxt & ChrW$(&H1EA8) & Right(sText, Len(sText) - i)
Case ChrW$(&H103): sText = sPreTxt & ChrW$(&H1EB3) & Right(sText, Len(sText) - i)
Case ChrW$(&H102): sText = sPreTxt & ChrW$(&H1EB2) & Right(sText, Len(sText) - i)

'e
Case "e": sText = sPreTxt & ChrW$(&H1EBB) & Right(sText, Len(sText) - i)
Case "E": sText = sPreTxt & ChrW$(&H1EBA) & Right(sText, Len(sText) - i)
Case ChrW$(&HEA): sText = sPreTxt & ChrW$(&H1EC3) & Right(sText, Len(sText) - i)
Case ChrW$(&HCA): sText = sPreTxt & ChrW$(&H1EC2) & Right(sText, Len(sText) - i)

'i
Case "i": sText = sPreTxt & ChrW$(&H1EC9) & Right(sText, Len(sText) - i)
Case "I": sText = sPreTxt & ChrW$(&H1EC8) & Right(sText, Len(sText) - i)

'o
Case "o": sText = sPreTxt & ChrW$(&H1ECF) & Right(sText, Len(sText) - i)
Case "O": sText = sPreTxt & ChrW$(&H1ECE) & Right(sText, Len(sText) - i)
Case ChrW$(&HF4): sText = sPreTxt & ChrW$(&H1ED5) & Right(sText, Len(sText) - i)
Case ChrW$(&HD4): sText = sPreTxt & ChrW$(&H1ED4) & Right(sText, Len(sText) - i)
Case ChrW$(&H1A1): sText = sPreTxt & ChrW$(&H1EDF) & Right(sText, Len(sText) - i)
Case ChrW$(&H1A0): sText = sPreTxt & ChrW$(&H1EDE) & Right(sText, Len(sText) - i)

'u
Case "u": sText = sPreTxt & ChrW$(&H1EE7) & Right(sText, Len(sText) - i)
Case "U": sText = sPreTxt & ChrW$(&H1EE6) & Right(sText, Len(sText) - i)
Case ChrW$(&H1B0): sText = sPreTxt & ChrW$(&H1EED) & Right(sText, Len(sText) - i)
Case ChrW$(&H1AF): sText = sPreTxt & ChrW$(&H1EEC) & Right(sText, Len(sText) - i)

'y
Case "y": sText = sPreTxt & ChrW$(&H1EF7) & Right(sText, Len(sText) - i)
Case "Y": sText = sPreTxt & ChrW$(&H1EF6) & Right(sText, Len(sText) - i)

End Select

Case "4"
Select Case sPreChar
'a
Case "a": sText = sPreTxt & ChrW$(&HE3) & Right(sText, Len(sText) - i)
Case "A": sText = sPreTxt & ChrW$(&HC3) & Right(sText, Len(sText) - i)
Case ChrW$(&HE2): sText = sPreTxt & ChrW$(&H1EAB) & Right(sText, Len(sText) - i)
Case ChrW$(&HC2): sText = sPreTxt & ChrW$(&H1EAA) & Right(sText, Len(sText) - i)
Case ChrW$(&H103): sText = sPreTxt & ChrW$(&H1EB5) & Right(sText, Len(sText) - i)
Case ChrW$(&H102): sText = sPreTxt & ChrW$(&H1EB4) & Right(sText, Len(sText) - i)

'e
Case "e": sText = sPreTxt & ChrW$(&H1EBD) & Right(sText, Len(sText) - i)
Case "E": sText = sPreTxt & ChrW$(&H1EBC) & Right(sText, Len(sText) - i)
Case ChrW$(&HEA): sText = sPreTxt & ChrW$(&H1EC5) & Right(sText, Len(sText) - i)
Case ChrW$(&HCA): sText = sPreTxt & ChrW$(&H1EC4) & Right(sText, Len(sText) - i)

'i
Case "i": sText = sPreTxt & ChrW$(&H129) & Right(sText, Len(sText) - i)
Case "I": sText = sPreTxt & ChrW$(&H128) & Right(sText, Len(sText) - i)

'o
Case "o": sText = sPreTxt & ChrW$(&HF5) & Right(sText, Len(sText) - i)
Case "O": sText = sPreTxt & ChrW$(&HD5) & Right(sText, Len(sText) - i)
Case ChrW$(&HF4): sText = sPreTxt & ChrW$(&H1ED7) & Right(sText, Len(sText) - i)
Case ChrW$(&HD4): sText = sPreTxt & ChrW$(&H1ED6) & Right(sText, Len(sText) - i)
Case ChrW$(&H1A1): sText = sPreTxt & ChrW$(&H1EE1) & Right(sText, Len(sText) - i)
Case ChrW$(&H1A0): sText = sPreTxt & ChrW$(&H1EE0) & Right(sText, Len(sText) - i)

'u
Case "u": sText = sPreTxt & ChrW$(&H169) & Right(sText, Len(sText) - i)
Case "U": sText = sPreTxt & ChrW$(&H168) & Right(sText, Len(sText) - i)
Case ChrW$(&H1B0): sText = sPreTxt & ChrW$(&H1EEF) & Right(sText, Len(sText) - i)
Case ChrW$(&H1AF): sText = sPreTxt & ChrW$(&H1EEE) & Right(sText, Len(sText) - i)

'y
Case "y": sText = sPreTxt & ChrW$(&H1EF9) & Right(sText, Len(sText) - i)
Case "Y": sText = sPreTxt & ChrW$(&H1EF8) & Right(sText, Len(sText) - i)
End Select

Case "5"
Select Case sPreChar
'a
Case "a": sText = sPreTxt & ChrW$(&H1EA1) & Right(sText, Len(sText) - i)
Case "A": sText = sPreTxt & ChrW$(&H1EA0) & Right(sText, Len(sText) - i)
Case ChrW$(&HE2): sText = sPreTxt & ChrW$(&H1EAD) & Right(sText, Len(sText) - i)
Case ChrW$(&HC2): sText = sPreTxt & ChrW$(&H1EAC) & Right(sText, Len(sText) - i)
Case ChrW$(&H103): sText = sPreTxt & ChrW$(&H1EB7) & Right(sText, Len(sText) - i)
Case ChrW$(&H102): sText = sPreTxt & ChrW$(&H1EB6) & Right(sText, Len(sText) - i)

'e
Case "e": sText = sPreTxt & ChrW$(&H1EB9) & Right(sText, Len(sText) - i)
Case "E": sText = sPreTxt & ChrW$(&H1EB8) & Right(sText, Len(sText) - i)
Case ChrW$(&HEA): sText = sPreTxt & ChrW$(&H1EC7) & Right(sText, Len(sText) - i)
Case ChrW$(&HCA): sText = sPreTxt & ChrW$(&H1EC6) & Right(sText, Len(sText) - i)

'i
Case "i": sText = sPreTxt & ChrW$(&H1ECB) & Right(sText, Len(sText) - i)
Case "I": sText = sPreTxt & ChrW$(&H1ECA) & Right(sText, Len(sText) - i)

'o
Case "o": sText = sPreTxt & ChrW$(&H1ECD) & Right(sText, Len(sText) - i)
Case "O": sText = sPreTxt & ChrW$(&H1ECC) & Right(sText, Len(sText) - i)
Case ChrW$(&HF4): sText = sPreTxt & ChrW$(&H1ED9) & Right(sText, Len(sText) - i)
Case ChrW$(&HD4): sText = sPreTxt & ChrW$(&H1ED8) & Right(sText, Len(sText) - i)
Case ChrW$(&H1A1): sText = sPreTxt & ChrW$(&H1EE3) & Right(sText, Len(sText) - i)
Case ChrW$(&H1A0): sText = sPreTxt & ChrW$(&H1EE2) & Right(sText, Len(sText) - i)

'u
Case "u": sText = sPreTxt & ChrW$(&H1EE5) & Right(sText, Len(sText) - i)
Case "U": sText = sPreTxt & ChrW$(&H1EE4) & Right(sText, Len(sText) - i)
Case ChrW$(&H1B0): sText = sPreTxt & ChrW$(&H1EF1) & Right(sText, Len(sText) - i)
Case ChrW$(&H1AF): sText = sPreTxt & ChrW$(&H1EF0) & Right(sText, Len(sText) - i)

'y
Case "y": sText = sPreTxt & ChrW$(&H1EF5) & Right(sText, Len(sText) - i)
Case "Y": sText = sPreTxt & ChrW$(&H1EF4) & Right(sText, Len(sText) - i)
End Select

Case "6"
Select Case sPreChar
'a
Case "a": sText = sPreTxt & ChrW$(&HE2) & Right(sText, Len(sText) - i)
Case "A": sText = sPreTxt & ChrW$(&HC2) & Right(sText, Len(sText) - i)

'e
Case "e": sText = sPreTxt & ChrW$(&HEA) & Right(sText, Len(sText) - i)
Case "E": sText = sPreTxt & ChrW$(&HCA) & Right(sText, Len(sText) - i)

'o
Case "o": sText = sPreTxt & ChrW$(&HF4) & Right(sText, Len(sText) - i)
Case "O": sText = sPreTxt & ChrW$(&HD4) & Right(sText, Len(sText) - i)
End Select

Case "7"
Select Case sPreChar
'o
Case "o": sText = sPreTxt & ChrW$(&H1A1) & Right(sText, Len(sText) - i)
Case "O": sText = sPreTxt & ChrW$(&H1A0) & Right(sText, Len(sText) - i)

'u
Case "u": sText = sPreTxt & ChrW$(&H1B0) & Right(sText, Len(sText) - i)
Case "U": sText = sPreTxt & ChrW$(&H1AF) & Right(sText, Len(sText) - i)
End Select

Case "8"
Select Case sPreChar
'a
Case "a": sText = sPreTxt & ChrW$(&H103) & Right(sText, Len(sText) - i)
Case "A": sText = sPreTxt & ChrW$(&H102) & Right(sText, Len(sText) - i)
End Select

Case "9"
Select Case sPreChar
'd
Case "d": sText = sPreTxt & ChrW$(&H111) & Right(sText, Len(sText) - i)
Case "D": sText = sPreTxt & ChrW$(&H110) & Right(sText, Len(sText) - i)
End Select

End Select
Next i
Next j
ToUniByVNI = sText
End Function

Public Function ToUniByTelex(ByVal sText As String) As String
Dim i As Integer, j As Integer
Dim sCurChar As String, sPreChar As String, sPreTxt As String
Dim cc As String

For j = 1 To 2
For i = 2 To Len(sText)
sCurChar = Mid(sText, i, 1)
sPreTxt = Left(sText, i - 2)
sPreChar = Mid(sText, i - 1, 1)
Select Case LCase(sCurChar)
Case "o"
Select Case sPreChar
Case "o": sText = sPreTxt & "ô" & Right(sText, Len(sText) - i)
Case UCase("o"): sText = sPreTxt & UCase("ô") & Right(sText, Len(sText) - i)
Case "ó": sText = sPreTxt & ChrW(&H1ED1) & Right(sText, Len(sText) - i)
Case UCase("ó"): sText = sPreTxt & UCase(ChrW(&H1ED1)) & Right(sText, Len(sText) - i)
Case "ò": sText = sPreTxt & ChrW(&H1ED3) & Right(sText, Len(sText) - i)
Case UCase("ò"): sText = sPreTxt & UCase(ChrW(&H1ED3)) & Right(sText, Len(sText) - i)
Case ChrW(&H1ECF): sText = sPreTxt & ChrW(&H1ED5) & Right(sText, Len(sText) - i)
Case UCase(ChrW(&H1ECF)): sText = sPreTxt & UCase(ChrW(&H1ED5)) & Right(sText, Len(sText) - i)
Case "õ": sText = sPreTxt & ChrW(&H1ED7) & Right(sText, Len(sText) - i)
Case UCase("õ"): sText = sPreTxt & UCase(ChrW(&H1ED7)) & Right(sText, Len(sText) - i)
Case ChrW(&H1ECD): sText = sPreTxt & ChrW(&H1ED9) & Right(sText, Len(sText) - i)
Case UCase(ChrW(&H1ECD)): sText = sPreTxt & UCase(ChrW(&H1ED9)) & Right(sText, Len(sText) - i)
End Select

Case "a"
Select Case sPreChar
Case "a": sText = sPreTxt & "â" & Right(sText, Len(sText) - i)
Case UCase("a"): sText = sPreTxt & UCase("â") & Right(sText, Len(sText) - i)
Case "á": sText = sPreTxt & ChrW(&H1EA5) & Right(sText, Len(sText) - i)
Case UCase("á"): sText = sPreTxt & UCase(ChrW(&H1EA5)) & Right(sText, Len(sText) - i)
Case "à": sText = sPreTxt & ChrW(&H1EA7) & Right(sText, Len(sText) - i)
Case UCase("à"): sText = sPreTxt & UCase(ChrW(&H1EA7)) & Right(sText, Len(sText) - i)
Case ChrW(&H1EA3): sText = sPreTxt & ChrW(&H1EA9) & Right(sText, Len(sText) - i)
Case UCase(ChrW(&H1EA3)): sText = sPreTxt & UCase(ChrW(&H1EA9)) & Right(sText, Len(sText) - i)
Case "ã": sText = sPreTxt & ChrW(&H1EAB) & Right(sText, Len(sText) - i)
Case UCase("ã"): sText = sPreTxt & UCase(ChrW(&H1EAB)) & Right(sText, Len(sText) - i)
Case ChrW(&H1EA1): sText = sPreTxt & ChrW(&H1EAD) & Right(sText, Len(sText) - i)
Case UCase(ChrW(&H1EA1)): sText = sPreTxt & UCase(ChrW(&H1EAD)) & Right(sText, Len(sText) - i)
End Select

Case "w"
Select Case sPreChar
Case "a": sText = sPreTxt & ChrW(&H103) & Right(sText, Len(sText) - i)
Case UCase("a"): sText = sPreTxt & UCase(ChrW(&H103)) & Right(sText, Len(sText) - i)
Case "á": sText = sPreTxt & ChrW(&H1EA5 + 9) & Right(sText, Len(sText) - i)
Case UCase("á"): sText = sPreTxt & UCase(ChrW(&H1EA5 + 9)) & Right(sText, Len(sText) - i)
Case "à": sText = sPreTxt & ChrW(&H1EA7 + 9) & Right(sText, Len(sText) - i)
Case UCase("à"): sText = sPreTxt & UCase(ChrW(&H1EA7 + 9)) & Right(sText, Len(sText) - i)
Case ChrW(&H1EA3): sText = sPreTxt & ChrW(&H1EA9 + 9) & Right(sText, Len(sText) - i)
Case UCase(ChrW(&H1EA3)): sText = sPreTxt & UCase(ChrW(&H1EA9 + 9)) & Right(sText, Len(sText) - i)
Case "ã": sText = sPreTxt & ChrW(&H1EAB + 9) & Right(sText, Len(sText) - i)
Case UCase("ã"): sText = sPreTxt & UCase(ChrW(&H1EAB + 9)) & Right(sText, Len(sText) - i)
Case ChrW(&H1EA1): sText = sPreTxt & ChrW(&H1EAD + 9) & Right(sText, Len(sText) - i)
Case UCase(ChrW(&H1EA1)): sText = sPreTxt & UCase(ChrW(&H1EAD + 9)) & Right(sText, Len(sText) - i)

Case "o": sText = sPreTxt & ChrW(&H1A1) & Right(sText, Len(sText) - i)
Case UCase("o"): sText = sPreTxt & UCase(ChrW(&H1A1)) & Right(sText, Len(sText) - i)
Case "ó": sText = sPreTxt & ChrW(&H1ED1 + 10) & Right(sText, Len(sText) - i)
Case UCase("ó"): sText = sPreTxt & UCase(ChrW(&H1ED1 + 10)) & Right(sText, Len(sText) - i)
Case "ò": sText = sPreTxt & ChrW(&H1ED3 + 10) & Right(sText, Len(sText) - i)
Case UCase("ò"): sText = sPreTxt & UCase(ChrW(&H1ED3 + 10)) & Right(sText, Len(sText) - i)
Case ChrW(&H1ECF): sText = sPreTxt & ChrW(&H1ED5 + 10) & Right(sText, Len(sText) - i)
Case UCase(ChrW(&H1ECF)): sText = sPreTxt & UCase(ChrW(&H1ED5 + 10)) & Right(sText, Len(sText) - i)
Case "õ": sText = sPreTxt & ChrW(&H1ED7 + 10) & Right(sText, Len(sText) - i)
Case UCase("õ"): sText = sPreTxt & UCase(ChrW(&H1ED7 + 10)) & Right(sText, Len(sText) - i)
Case ChrW(&H1ECD): sText = sPreTxt & ChrW(&H1ED9 + 10) & Right(sText, Len(sText) - i)
Case UCase(ChrW(&H1ECD)): sText = sPreTxt & UCase(ChrW(&H1ED9 + 10)) & Right(sText, Len(sText) - i)

Case "u": sText = sPreTxt & ChrW(&H1B0) & Right(sText, Len(sText) - i)
Case UCase("u"): sText = sPreTxt & UCase(ChrW(&H1B0)) & Right(sText, Len(sText) - i)
Case "ú": sText = sPreTxt & ChrW(&H1EE9) & Right(sText, Len(sText) - i)
Case UCase("ú"): sText = sPreTxt & UCase(ChrW(&H1EE9)) & Right(sText, Len(sText) - i)
Case "ù": sText = sPreTxt & ChrW(&H1EEB) & Right(sText, Len(sText) - i)
Case UCase("ù"): sText = sPreTxt & UCase(ChrW(&H1EEB)) & Right(sText, Len(sText) - i)
Case ChrW(&H1EE7): sText = sPreTxt & ChrW(&H1EED) & Right(sText, Len(sText) - i)
Case UCase(ChrW(&H1EE7)): sText = sPreTxt & UCase(ChrW(&H1EED)) & Right(sText, Len(sText) - i)
Case ChrW(&H169): sText = sPreTxt & ChrW(&H1EEF) & Right(sText, Len(sText) - i)
Case UCase(ChrW(&H169)): sText = sPreTxt & UCase(ChrW(&H1EEF)) & Right(sText, Len(sText) - i)
Case ChrW(&H1EE5): sText = sPreTxt & ChrW(&H1EF1) & Right(sText, Len(sText) - i)
Case UCase(ChrW(&H1EE5)): sText = sPreTxt & UCase(ChrW(&H1EF1)) & Right(sText, Len(sText) - i)

End Select

Case "e"
Select Case sPreChar
Case "e": sText = sPreTxt & "ê" & Right(sText, Len(sText) - i)
Case UCase("e"): sText = sPreTxt & UCase("ê") & Right(sText, Len(sText) - i)
Case "é": sText = sPreTxt & ChrW(&H1EBF) & Right(sText, Len(sText) - i)
Case UCase("é"): sText = sPreTxt & UCase(ChrW(&H1EBF)) & Right(sText, Len(sText) - i)
Case "è": sText = sPreTxt & ChrW(&H1EC1) & Right(sText, Len(sText) - i)
Case UCase("è"): sText = sPreTxt & ChrW(&H1EC1) & Right(sText, Len(sText) - i)
Case ChrW(&H1EBB): sText = sPreTxt & ChrW(&H1EC3) & Right(sText, Len(sText) - i)
Case UCase(ChrW(&H1EBB)): sText = sPreTxt & UCase(ChrW(&H1EC3)) & Right(sText, Len(sText) - i)
Case ChrW(&H1EBD): sText = sPreTxt & ChrW(&H1EC5) & Right(sText, Len(sText) - i)
Case UCase(ChrW(&H1EBD)): sText = sPreTxt & UCase(ChrW(&H1EC5)) & Right(sText, Len(sText) - i)
Case ChrW(&H1EB9): sText = sPreTxt & ChrW(&H1EC7) & Right(sText, Len(sText) - i)
Case UCase(ChrW(&H1EB9)): sText = sPreTxt & UCase(ChrW(&H1EC7)) & Right(sText, Len(sText) - i)
End Select


Case "d"
Select Case sPreChar
Case "d": sText = sPreTxt & ChrW(&H111) & Right(sText, Len(sText) - i)
Case UCase("d"): sText = sPreTxt & UCase(ChrW(&H110)) & Right(sText, Len(sText) - i)
End Select

Case "s"
Select Case sPreChar
Case "o": sText = sPreTxt & "ó" & Right(sText, Len(sText) - i)
Case "O": sText = sPreTxt & UCase("ó") & Right(sText, Len(sText) - i)
Case "a": sText = sPreTxt & "á" & Right(sText, Len(sText) - i)
Case "A": sText = sPreTxt & UCase("á") & Right(sText, Len(sText) - i)
Case "e": sText = sPreTxt & "é" & Right(sText, Len(sText) - i)
Case "E": sText = sPreTxt & UCase("é") & Right(sText, Len(sText) - i)
Case "u": sText = sPreTxt & "ú" & Right(sText, Len(sText) - i)
Case "U": sText = sPreTxt & UCase("ú") & Right(sText, Len(sText) - i)
Case "i": sText = sPreTxt & "í" & Right(sText, Len(sText) - i)
Case "I": sText = sPreTxt & UCase("í") & Right(sText, Len(sText) - i)
Case "y": sText = sPreTxt & "ý" & Right(sText, Len(sText) - i)
Case "Y": sText = sPreTxt & UCase("ý") & Right(sText, Len(sText) - i)

Case "ô": sText = sPreTxt & ChrW(&H1ED1) & Right(sText, Len(sText) - i)
Case UCase("ô"): sText = sPreTxt & UCase(ChrW(&H1ED1)) & Right(sText, Len(sText) - i)
Case ChrW(&H1A1): sText = sPreTxt & ChrW(&H1EDB) & Right(sText, Len(sText) - i)
Case UCase(ChrW(&H1A1)): sText = sPreTxt & UCase(ChrW(&H1EDB)) & Right(sText, Len(sText) - i)
Case "â": sText = sPreTxt & ChrW(&H1EA5) & Right(sText, Len(sText) - i)
Case UCase("â"): sText = sPreTxt & UCase(ChrW(&H1EA5)) & Right(sText, Len(sText) - i)
Case ChrW(&H103): sText = sPreTxt & ChrW(&H1EAF) & Right(sText, Len(sText) - i)
Case UCase(ChrW(&H103)): sText = sPreTxt & UCase(ChrW(&H1EAF)) & Right(sText, Len(sText) - i)
Case "ê": sText = sPreTxt & ChrW(&H1EBF) & Right(sText, Len(sText) - i)
Case UCase("ê"): sText = sPreTxt & UCase(ChrW(&H1EBF)) & Right(sText, Len(sText) - i)
Case ChrW(&H1B0): sText = sPreTxt & ChrW(&H1EE9) & Right(sText, Len(sText) - i)
Case UCase(ChrW(&H1B0)): sText = sPreTxt & UCase(ChrW(&H1EE9)) & Right(sText, Len(sText) - i)
End Select
Case "f"
Select Case sPreChar
Case "o": sText = sPreTxt & "ò" & Right(sText, Len(sText) - i)
Case "O": sText = sPreTxt & UCase("ò") & Right(sText, Len(sText) - i)
Case "a": sText = sPreTxt & "à" & Right(sText, Len(sText) - i)
Case "A": sText = sPreTxt & UCase("à") & Right(sText, Len(sText) - i)
Case "e": sText = sPreTxt & "è" & Right(sText, Len(sText) - i)
Case "E": sText = sPreTxt & UCase("è") & Right(sText, Len(sText) - i)
Case "u": sText = sPreTxt & "ù" & Right(sText, Len(sText) - i)
Case "U": sText = sPreTxt & UCase("ù") & Right(sText, Len(sText) - i)
Case "i": sText = sPreTxt & "ì" & Right(sText, Len(sText) - i)
Case "I": sText = sPreTxt & UCase("ì") & Right(sText, Len(sText) - i)
Case "y": sText = sPreTxt & ChrW(&H1EF3) & Right(sText, Len(sText) - i)
Case "Y": sText = sPreTxt & UCase(ChrW(&H1EF3)) & Right(sText, Len(sText) - i)

Case "ô": sText = sPreTxt & ChrW(&H1ED1 + 2) & Right(sText, Len(sText) - i)
Case UCase("ô"): sText = sPreTxt & UCase(ChrW(&H1ED1 + 2)) & Right(sText, Len(sText) - i)
Case ChrW(&H1A1): sText = sPreTxt & ChrW(&H1EDB + 2) & Right(sText, Len(sText) - i)
Case UCase(ChrW(&H1A1)): sText = sPreTxt & UCase(ChrW(&H1EDB + 2)) & Right(sText, Len(sText) - i)
Case "â": sText = sPreTxt & ChrW(&H1EA5 + 2) & Right(sText, Len(sText) - i)
Case UCase("â"): sText = sPreTxt & UCase(ChrW(&H1EA5 + 2)) & Right(sText, Len(sText) - i)
Case ChrW(&H103): sText = sPreTxt & ChrW(&H1EAF + 2) & Right(sText, Len(sText) - i)
Case UCase(ChrW(&H103)): sText = sPreTxt & UCase(ChrW(&H1EAF + 2)) & Right(sText, Len(sText) - i)
Case "ê": sText = sPreTxt & ChrW(&H1EBF + 2) & Right(sText, Len(sText) - i)
Case UCase("ê"): sText = sPreTxt & UCase(ChrW(&H1EBF + 2)) & Right(sText, Len(sText) - i)
Case ChrW(&H1B0): sText = sPreTxt & ChrW(&H1EE9 + 2) & Right(sText, Len(sText) - i)
Case UCase(ChrW(&H1B0)): sText = sPreTxt & UCase(ChrW(&H1EE9 + 2)) & Right(sText, Len(sText) - i)
End Select
Case "r"
Select Case sPreChar
Case "o": sText = sPreTxt & ChrW(&H1ECF) & Right(sText, Len(sText) - i)
Case "O": sText = sPreTxt & UCase(ChrW(&H1ECF)) & Right(sText, Len(sText) - i)
Case "a": sText = sPreTxt & ChrW(&H1EA3) & Right(sText, Len(sText) - i)
Case "A": sText = sPreTxt & UCase(ChrW(&H1EA3)) & Right(sText, Len(sText) - i)
Case "e": sText = sPreTxt & ChrW(&H1EBB) & Right(sText, Len(sText) - i)
Case "E": sText = sPreTxt & UCase(ChrW(&H1EBB)) & Right(sText, Len(sText) - i)
Case "u": sText = sPreTxt & ChrW(&H1EE7) & Right(sText, Len(sText) - i)
Case "U": sText = sPreTxt & UCase(ChrW(&H1EE7)) & Right(sText, Len(sText) - i)
Case "i": sText = sPreTxt & ChrW(&H1EC9) & Right(sText, Len(sText) - i)
Case "I": sText = sPreTxt & UCase(ChrW(&H1EC9)) & Right(sText, Len(sText) - i)
Case "y": sText = sPreTxt & ChrW(&H1EF7) & Right(sText, Len(sText) - i)
Case "Y": sText = sPreTxt & UCase(ChrW(&H1EF7)) & Right(sText, Len(sText) - i)

Case "ô": sText = sPreTxt & ChrW(&H1ED1 + 4) & Right(sText, Len(sText) - i)
Case UCase("ô"): sText = sPreTxt & UCase(ChrW(&H1ED1 + 4)) & Right(sText, Len(sText) - i)
Case ChrW(&H1A1): sText = sPreTxt & ChrW(&H1EDB + 4) & Right(sText, Len(sText) - i)
Case UCase(ChrW(&H1A1)): sText = sPreTxt & UCase(ChrW(&H1EDB + 4)) & Right(sText, Len(sText) - i)
Case "â": sText = sPreTxt & ChrW(&H1EA5 + 4) & Right(sText, Len(sText) - i)
Case UCase("â"): sText = sPreTxt & UCase(ChrW(&H1EA5 + 4)) & Right(sText, Len(sText) - i)
Case ChrW(&H103): sText = sPreTxt & ChrW(&H1EAF + 4) & Right(sText, Len(sText) - i)
Case UCase(ChrW(&H103)): sText = sPreTxt & UCase(ChrW(&H1EAF + 4)) & Right(sText, Len(sText) - i)
Case "ê": sText = sPreTxt & ChrW(&H1EBF + 4) & Right(sText, Len(sText) - i)
Case UCase("ê"): sText = sPreTxt & UCase(ChrW(&H1EBF + 4)) & Right(sText, Len(sText) - i)
Case ChrW(&H1B0): sText = sPreTxt & ChrW(&H1EE9 + 4) & Right(sText, Len(sText) - i)
Case UCase(ChrW(&H1B0)): sText = sPreTxt & UCase(ChrW(&H1EE9 + 4)) & Right(sText, Len(sText) - i)
End Select
Case "x"
Select Case sPreChar
Case "o": sText = sPreTxt & "õ" & Right(sText, Len(sText) - i)
Case "O": sText = sPreTxt & UCase("õ") & Right(sText, Len(sText) - i)
Case "a": sText = sPreTxt & "ã" & Right(sText, Len(sText) - i)
Case "A": sText = sPreTxt & UCase("ã") & Right(sText, Len(sText) - i)
Case "e": sText = sPreTxt & ChrW(&H1EBD) & Right(sText, Len(sText) - i)
Case "E": sText = sPreTxt & UCase(ChrW(&H1EBD)) & Right(sText, Len(sText) - i)
Case "u": sText = sPreTxt & ChrW(&H169) & Right(sText, Len(sText) - i)
Case "U": sText = sPreTxt & UCase(ChrW(&H169)) & Right(sText, Len(sText) - i)
Case "i": sText = sPreTxt & ChrW(&H129) & Right(sText, Len(sText) - i)
Case "I": sText = sPreTxt & UCase(ChrW(&H129)) & Right(sText, Len(sText) - i)
Case "y": sText = sPreTxt & ChrW(&H1EF7 + 2) & Right(sText, Len(sText) - i)
Case "Y": sText = sPreTxt & UCase(ChrW(&H1EF7 + 2)) & Right(sText, Len(sText) - i)

Case "ô": sText = sPreTxt & ChrW(&H1ED1 + 6) & Right(sText, Len(sText) - i)
Case UCase("ô"): sText = sPreTxt & UCase(ChrW(&H1ED1 + 6)) & Right(sText, Len(sText) - i)
Case ChrW(&H1A1): sText = sPreTxt & ChrW(&H1EDB + 6) & Right(sText, Len(sText) - i)
Case UCase(ChrW(&H1A1)): sText = sPreTxt & UCase(ChrW(&H1EDB + 6)) & Right(sText, Len(sText) - i)
Case "â": sText = sPreTxt & ChrW(&H1EA5 + 6) & Right(sText, Len(sText) - i)
Case UCase("â"): sText = sPreTxt & UCase(ChrW(&H1EA5 + 6)) & Right(sText, Len(sText) - i)
Case ChrW(&H103): sText = sPreTxt & ChrW(&H1EAF + 6) & Right(sText, Len(sText) - i)
Case UCase(ChrW(&H103)): sText = sPreTxt & UCase(ChrW(&H1EAF + 6)) & Right(sText, Len(sText) - i)
Case "ê": sText = sPreTxt & ChrW(&H1EBF + 6) & Right(sText, Len(sText) - i)
Case UCase("ê"): sText = sPreTxt & UCase(ChrW(&H1EBF + 6)) & Right(sText, Len(sText) - i)
Case ChrW(&H1B0): sText = sPreTxt & ChrW(&H1EE9 + 6) & Right(sText, Len(sText) - i)
Case UCase(ChrW(&H1B0)): sText = sPreTxt & UCase(ChrW(&H1EE9 + 6)) & Right(sText, Len(sText) - i)
End Select

Case "j"
Select Case sPreChar
Case "o": sText = sPreTxt & ChrW(&H1ECD) & Right(sText, Len(sText) - i)
Case "O": sText = sPreTxt & UCase(ChrW(&H1ECD)) & Right(sText, Len(sText) - i)
Case "a": sText = sPreTxt & ChrW(&H1EA1) & Right(sText, Len(sText) - i)
Case "A": sText = sPreTxt & UCase(ChrW(&H1EA1)) & Right(sText, Len(sText) - i)
Case "e": sText = sPreTxt & ChrW(&H1EB9) & Right(sText, Len(sText) - i)
Case "E": sText = sPreTxt & UCase(ChrW(&H1EB9)) & Right(sText, Len(sText) - i)
Case "u": sText = sPreTxt & ChrW(&H1EE5) & Right(sText, Len(sText) - i)
Case "U": sText = sPreTxt & UCase(ChrW(&H1EE5)) & Right(sText, Len(sText) - i)
Case "i": sText = sPreTxt & ChrW(&H1ECB) & Right(sText, Len(sText) - i)
Case "I": sText = sPreTxt & UCase(ChrW(&H1ECB)) & Right(sText, Len(sText) - i)
Case "y": sText = sPreTxt & ChrW(&H1EF5) & Right(sText, Len(sText) - i)
Case "Y": sText = sPreTxt & UCase(ChrW(&H1EF5)) & Right(sText, Len(sText) - i)

Case "ô": sText = sPreTxt & ChrW(&H1ED1 + 8) & Right(sText, Len(sText) - i)
Case UCase("ô"): sText = sPreTxt & UCase(ChrW(&H1ED1 + 8)) & Right(sText, Len(sText) - i)
Case ChrW(&H1A1): sText = sPreTxt & ChrW(&H1EDB + 8) & Right(sText, Len(sText) - i)
Case UCase(ChrW(&H1A1)): sText = sPreTxt & UCase(ChrW(&H1EDB + 8)) & Right(sText, Len(sText) - i)
Case "â": sText = sPreTxt & ChrW(&H1EA5 + 8) & Right(sText, Len(sText) - i)
Case UCase("â"): sText = sPreTxt & UCase(ChrW(&H1EA5 + 8)) & Right(sText, Len(sText) - i)
Case ChrW(&H103): sText = sPreTxt & ChrW(&H1EAF + 8) & Right(sText, Len(sText) - i)
Case UCase(ChrW(&H103)): sText = sPreTxt & UCase(ChrW(&H1EAF + 8)) & Right(sText, Len(sText) - i)
Case "ê": sText = sPreTxt & ChrW(&H1EBF + 8) & Right(sText, Len(sText) - i)
Case UCase("ê"): sText = sPreTxt & UCase(ChrW(&H1EBF + 8)) & Right(sText, Len(sText) - i)
Case ChrW(&H1B0): sText = sPreTxt & ChrW(&H1EE9 + 8) & Right(sText, Len(sText) - i)
Case UCase(ChrW(&H1B0)): sText = sPreTxt & UCase(ChrW(&H1EE9 + 8)) & Right(sText, Len(sText) - i)
End Select

End Select

Next i
Next j
ToUniByTelex = sText
End Function

Public Function ToUni(ByVal sText As String, Optional Spec_Char As String = "*", Optional Auto_VNI_TEX_012 As Byte = 0) As String
Dim cA() As String, j As Long, nText As String
cA = Split(Replace(sText, "\enter", Chr(13) & Chr(10), 1, Len(sText), 0), Spec_Char)

For j = 1 To UBound(cA) Step 2
Select Case Auto_VNI_TEX_012
Case 0
cA(j) = ToUniByVNI(ToUniByTelex(cA(j)))
Case 1
cA(j) = ToUniByVNI(cA(j))
Case 2
cA(j) = ToUniByTelex(cA(j))
End Select
Next

For j = 0 To UBound(cA)
nText = nText & cA(j)
Next

ToUni = nText
End Function

Public Sub ToUniObj(ByVal Obj As Object)
On Error Resume Next
If Obj.Text <> "" Then
Obj.Text = ToUni(Obj.Text)
Else
Obj.Caption = ToUni(Obj.Caption)
End If
End Sub
[/vb]
Download:
http://caulacbovb.com/forum/download/file.php?id=1594



Hình đại diện của người dùng
VuVanHoanh
Thành viên danh dự
Thành viên danh dự
Bài viết: 1259
Ngày tham gia: T.Năm 03/06/2010 9:23 pm
Đến từ: Kim Sơn - Đông Triều - Quảng Ninh
Has thanked: 22 time
Been thanked: 137 time
Liên hệ:

Re: Tổng hợp Unicode trong VB6

Gửi bàigửi bởi VuVanHoanh » T.Bảy 21/01/2012 11:18 am

:D Thế thì không thể thiếu Control Unicode :D
Since 2008...
One love! :x

baohiep
Thành viên danh dự
Thành viên danh dự
Bài viết: 109
Ngày tham gia: CN 27/12/2009 6:37 pm
Đến từ: Tam Kỳ
Has thanked: 3 time
Been thanked: 9 time

Re: Tổng hợp Unicode trong VB6

Gửi bàigửi bởi baohiep » T.Bảy 21/01/2012 11:27 pm

Thêm mấy bài đây:
http://caulacbovb.com/forum/viewtopic.php?t=20638
http://caulacbovb.com/forum/viewtopic.php?t=20607
http://caulacbovb.com/forum/viewtopic.php?t=20631
Control:
Vào bài hướng dẫn tạo Control của anh Hưng. Trong đó có hướng dẫn tạo UniControl đó.
http://caulacbovb.com/forum/viewtopic.php?f=22&t=196
Hay cái iVB UnicodeControls v2.0 của iVB Group:
http://caulacbovb.com/forum/viewtopic.php?f=36&t=307

baohiep
Thành viên danh dự
Thành viên danh dự
Bài viết: 109
Ngày tham gia: CN 27/12/2009 6:37 pm
Đến từ: Tam Kỳ
Has thanked: 3 time
Been thanked: 9 time

Re: Tổng hợp Unicode trong VB6

Gửi bàigửi bởi baohiep » T.Bảy 21/01/2012 11:32 pm

UniMsgBox:
  1. Option Explicit
  2.  
  3. Public hDlgHook As Long
  4.  
  5. Private Const FONT_FACE = "Tahoma"
  6.  
  7. Public Const WH_CBT = 5
  8. Private Const HCBT_ACTIVATE = 5
  9. Private Const WM_SETFONT = &H30
  10. Private Const MB_TASKMODAL = &H2000&
  11.  
  12. Declare Function CreateFont Lib "gdi32" Alias "CreateFontA" (ByVal h As Long, ByVal W As Long, ByVal E As Long, ByVal O As Long, ByVal W As Long, ByVal i As Long, ByVal U As Long, ByVal s As Long, ByVal C As Long, ByVal OP As Long, ByVal CP As Long, ByVal Q As Long, ByVal PAF As Long, ByVal F As String) As Long
  13. Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal ParenthWnd As Long, ByVal ChildhWnd As Long, ByVal ClassName As String, ByVal Caption As String) As Long
  14. Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As Long, ByVal hMod As Long, ByVal dwThreadId As Long) As Long
  15. Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal ncode As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
  16. Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long
  17. Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
  18. Declare Function GetCurrentThreadId Lib "kernel32" () As Long
  19. Declare Function SetWindowTextW Lib "user32" (ByVal hwnd As Long, ByVal lpString As Long) As Long
  20. Declare Function MessageBoxW Lib "user32.dll" (ByVal hwnd As Long, ByVal lpText As Long, ByVal lpCaption As Long, ByVal uType As Long) As Long
  21.  
  22. Public Function UniMsgBox(strText As String, Optional iButtons As VbMsgBoxStyle = vbOKOnly, Optional strTitle As String, Optional hwnd As Long = &H0) As VbMsgBoxResult
  23.     Dim sTam1 As String, sTam2 As String
  24.    
  25.         sTam1 = ToUnicode(strText)
  26.         sTam2 = ToUnicode(strTitle)
  27.        
  28.         hDlgHook = SetWindowsHookEx(WH_CBT, AddressOf HookProc, App.hInstance, GetCurrentThreadId())
  29.         UniMsgBox = MessageBoxW(hwnd, StrPtr(sTam1), StrPtr(sTam2), iButtons Or MB_TASKMODAL)
  30. End Function
  31.  
  32. Private Function HookProc(ByVal ncode As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
  33.     Dim hStatic1 As Long, hStatic2 As Long, hButton As Long, hFont As Long
  34.     HookProc = CallNextHookEx(hDlgHook, ncode, wParam, lParam)
  35.     If ncode = HCBT_ACTIVATE Then
  36.         hFont = CreateFont(13, 0, 0, 0, 500, 0, 0, 0, 0, 0, 0, 0, 0, FONT_FACE)
  37.    
  38.         hStatic1 = FindWindowEx(wParam, 0&, "Static", vbNullString)
  39.         hStatic2 = FindWindowEx(wParam, hStatic1, "Static", vbNullString)
  40.         If hStatic2 = 0 Then hStatic2 = hStatic1
  41.         SendMessage hStatic2, WM_SETFONT, hFont, ByVal 1&
  42.  
  43.         hButton = FindWindowEx(wParam, 0&, "Button", "OK")
  44.         SendMessage hButton, WM_SETFONT, hFont, 0
  45.         SetWindowTextW hButton, StrPtr(ToUnicode("D9o62&ng Y1"))
  46.          
  47.         hButton = FindWindowEx(wParam, 0&, "Button", "&Yes")
  48.         SendMessage hButton, WM_SETFONT, hFont, 0
  49.         SetWindowTextW hButton, StrPtr(ToUnicode("&Co1"))
  50.    
  51.         hButton = FindWindowEx(wParam, 0&, "Button", "&No")
  52.         SendMessage hButton, WM_SETFONT, hFont, 0
  53.         SetWindowTextW hButton, StrPtr(ToUnicode("&Kho6ng"))
  54.    
  55.         hButton = FindWindowEx(wParam, 0&, "Button", "Cancel")
  56.         SendMessage hButton, WM_SETFONT, hFont, 0
  57.         SetWindowTextW hButton, StrPtr(ToUnicode("&Tho6i"))
  58.    
  59.         hButton = FindWindowEx(wParam, 0&, "Button", "&Retry")
  60.         SendMessage hButton, WM_SETFONT, hFont, 0
  61.         SetWindowTextW hButton, StrPtr(ToUnicode("&Thu73 la5i"))
  62.    
  63.         hButton = FindWindowEx(wParam, 0&, "Button", "&Ignore")
  64.         SendMessage hButton, WM_SETFONT, hFont, 0
  65.         SetWindowTextW hButton, StrPtr(ToUnicode("&Tho6i")) 'Bo3 qua"))
  66.        
  67.         hButton = FindWindowEx(wParam, 0&, "Button", "&Abort")
  68.         SendMessage hButton, WM_SETFONT, hFont, 0
  69.         SetWindowTextW hButton, StrPtr(ToUnicode("&Xua61t ra *.txt")) '&Hu3y bo3"))
  70.  
  71.         hButton = FindWindowEx(wParam, 0&, "Button", "Help")
  72.         SendMessage hButton, WM_SETFONT, hFont, 0
  73.         SetWindowTextW hButton, StrPtr(ToUnicode("Giu1p d9o74"))
  74.        
  75.         UnhookWindowsHookEx hDlgHook
  76.     End If
  77. End Function
  78.  

Thêm code vào một Module.

Trong Form, khi nào dùng thì gọi hàm UniMsgBox (Gõ kiểu VNI).

dongdo1234
Thành viên chính thức
Thành viên chính thức
Bài viết: 19
Ngày tham gia: T.Sáu 18/01/2013 8:56 am
Đến từ: Giao Thủy - Nam Định
Has thanked: 8 time
Been thanked: 1 time
Liên hệ:

Re: Tổng hợp Unicode trong VB6

Gửi bàigửi bởi dongdo1234 » T.Ba 10/06/2014 2:37 pm

Ae cho hoi mấy cái Funtion trên dùng thế nào vậy
ToUniByVNI ; UniMsgBox; ToUniByTelex ...
>> Mình đã add module nhưng gọi hàm không thấy kết quả

Hình đại diện của người dùng
tungblt
Điều hành viên
Điều hành viên
Bài viết: 548
Ngày tham gia: T.Hai 22/12/2008 5:22 pm
Đến từ: quy nhơn
Has thanked: 6 time
Been thanked: 76 time
Liên hệ:

Re: Tổng hợp Unicode trong VB6

Gửi bàigửi bởi tungblt » T.Tư 11/06/2014 4:43 pm

Label1.Caption = TounibyVni ("ca6u la5c bo65 VB")
UniMsgBox "nội dung thông báo","Tiêu đề thông báo"
Label1.Caption = ToUniByTelex ("caau lajc booj VB")
love


Quay về “[VB] Bài viết hướng dẫn”

Đang trực tuyến

Đang xem chuyên mục này: Không có thành viên nào trực tuyến.1 khách