Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 285
  • Last Modified:

Unicode VB6 menus?

Is there a way to make VB6 menus show Unicode characters? And if possible, without using third party menu controls...
0
npaun
Asked:
npaun
  • 6
  • 5
  • 2
1 Solution
 
louisfrCommented:
Why don't you write your Form in VB.NET ?
0
 
npaunAuthor Commented:
maintenance in an old VB6 application, so it must be in VB6...
0
 
louisfrCommented:
You could have one Form in VB.NET in a VB6 application.
Otherwise, I'm not sure there is an easy way to add Unicode support to the menus. maybe calling Windows API?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
npaunAuthor Commented:
Well, probably there is no easy way, and most definitely I'm expecting to be something by using API...
I'm not quite sure what do you meant by "You could have one Form in VB.NET in a VB6 application."?
0
 
louisfrCommented:
A VB.NET Form can be used by VB6 if you use the "COM interop" checkbox of the project.
0
 
npaunAuthor Commented:
aha, ok. However, no interop acceptable in this case...
0
 
louisfrCommented:
If I find anything, I'll let you know.
0
 
npaunAuthor Commented:
ths
0
 
aikimarkCommented:
I'm pretty sure that you can't do this with the built in menu feature.  You would have to replace the current menus with fake ones, that behaved the same way.
0
 
npaunAuthor Commented:
I would expect to be so. An API created popup menu with Unicode enabled submenus would suffice at the moment...
0
 
aikimarkCommented:
I don't think you're going to be able to do this with just some API calls.
0
 
louisfrCommented:
Private Const MIIM_STRING = &H40

Private 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 String
cch As Long
End Type

Private Declare Function GetMenu Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetSubMenu Lib "user32" (ByVal hMenu As Long, ByVal nPos As Long) As Long
Private Declare Function SetMenuItemInfo Lib "user32" Alias "SetMenuItemInfoW" (ByVal hMenu As Long, ByVal uItem As Long, ByVal fByPosition As Long, lpmii As MENUITEMINFO) As Long

Private Sub Form_Load()
    Dim hMenu As Long, hSubMenu As Long, MII As MENUITEMINFO
    'get the handle of the current menu
    hMenu = GetMenu(Me.hwnd)
    'get the handle of the first submenu
    hSubMenu = GetSubMenu(hMenu, 0)
    'initialize the structure
    MII.cbSize = Len(MII)
    MII.fMask = MIIM_STRING
    MII.dwTypeData = StrConv("H" & ChrW(7879) & " th" & ChrW(7889) & "ng", vbUnicode)
    SetMenuItemInfo hSubMenu, 0, True, MII
End Sub

Open in new window

0
 
npaunAuthor Commented:
Works perfectly. Well done! Thanks.
PS: you might be interested in looking on my new question http://www.experts-exchange.com/Programming/Languages/Visual_Basic/Q_28597405.html
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 6
  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now