Solved

Unicode VB6 menus?

Posted on 2015-01-14
13
230 Views
Last Modified: 2015-01-15
Is there a way to make VB6 menus show Unicode characters? And if possible, without using third party menu controls...
0
Comment
Question by:npaun
  • 6
  • 5
  • 2
13 Comments
 
LVL 11

Expert Comment

by:louisfr
ID: 40549005
Why don't you write your Form in VB.NET ?
0
 

Author Comment

by:npaun
ID: 40549026
maintenance in an old VB6 application, so it must be in VB6...
0
 
LVL 11

Expert Comment

by:louisfr
ID: 40549214
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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:npaun
ID: 40549236
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
 
LVL 11

Expert Comment

by:louisfr
ID: 40549256
A VB.NET Form can be used by VB6 if you use the "COM interop" checkbox of the project.
0
 

Author Comment

by:npaun
ID: 40549292
aha, ok. However, no interop acceptable in this case...
0
 
LVL 11

Expert Comment

by:louisfr
ID: 40549395
If I find anything, I'll let you know.
0
 

Author Comment

by:npaun
ID: 40549417
ths
0
 
LVL 45

Expert Comment

by:aikimark
ID: 40549569
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
 

Author Comment

by:npaun
ID: 40549840
I would expect to be so. An API created popup menu with Unicode enabled submenus would suffice at the moment...
0
 
LVL 45

Expert Comment

by:aikimark
ID: 40549921
I don't think you're going to be able to do this with just some API calls.
0
 
LVL 11

Accepted Solution

by:
louisfr earned 500 total points
ID: 40550728
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
 

Author Closing Comment

by:npaun
ID: 40551374
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VB.NET return row from SQL to DataSet and get column values ? 3 51
VB.Net Tranfer data between to VB.Net apps 8 25
.NET 2008 VB and C# 6 28
vb.net class 3 14
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question