Language resource files

Posted on 2003-02-28
Medium Priority
Last Modified: 2010-05-01
I am using resource files to allow my app to use different languages depending on the regional settings selected on the local computer.

I can not find out how to get the captions on msgbox buttons to change.

Normal buttons are no problem but when i use a msgbox and use vbYesNo (for example) to include the buttons yes and no i cant get these buttons to change their caption.

Any clues?
Question by:Kels
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 18

Expert Comment

ID: 8041861
Create your own Messagebox using a form and sizing it like a messagebox. Then put a label on the form and two command buttons. Use the strings from Resource file. The msgbox that is displayed by VB uses Windows API's so you will have to use Win API's to change the text in that msgbox. Use the following sites to look into that code:
or www.planet-source-code.com

Expert Comment

ID: 8042212
Sethi's right, the captions on the textbox only depend on the language of the OS. Easiest alternative is creating a form that looks similar.

Expert Comment

ID: 8042922
Yet there is another way:hooking
you can hook the creation of the msgbox, and then change the text for the buttons.

for clearance, here i provide you an example:

'.bas module
public hHook as long

public sub HookMe(frm as Form)
hHook=SetWindowsHookEx(WH_CBT, AddressOf MsgBoxHookProc, App.hInstance, App.ThreadID)
end sub

public sub unhookMe(frm as Form)
UnhookWindowsHookEx hHook
end sub

public function MsgBoxhookProc(ByVal uMsg As Long, _
                               ByVal wParam As Long, _
                               ByVal lParam As Long) As Long
if uMsg=HCBT_ACTIVATE then
    SetDlgItemText wParam, IDOK, "MyOk"
    SetDlgItemText wParam, IDCANCEL,"MyCancel"
    UnhookWindowsHookEx hHook
end if
end function

that's it, try! enjoy programming!

Accepted Solution

Belfry earned 270 total points
ID: 8043028
sorry, some supplement:

'in the form code,before using msgbox, just call hook me

HookMe me'i don't know why i put a 'me' as parameter, it's not used, :)
msgbox "my title",vbyesnocancel,...

that's all
(btw. unhookMe is of no use, because once you have changed the texts for the buttons, you immediately unhook the hook)

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses
Course of the Month11 days, 20 hours left to enroll

752 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