-
January 31st, 2012, 08:41 AM
#1
language in MsgBox
hi all,
how is possible to change language for msgbox (e.g. button caption) "Yes" in "Oui" or "Ja".
other solution like create an dedicated form and manage all messages.
thanks for any links, tutorials, piece fo codes ...
-
January 31st, 2012, 09:00 AM
#2
Re: language in MsgBox
1: change the system language
or
2: create your own msgbox
Always use [code][/code] tags when posting code.
-
January 31st, 2012, 10:10 AM
#3
Re: language in MsgBox
i try to use this solution
i put in each form a Timer (named in all forms "tmes") witch call a function "fTmes"
in a Module i try to use some API function and i create few function.
this is the code:
I will put here entire code, including all comments, for someone wich want to use the code
Option Explicit
'Settings
'The buttons argument settings are:
'Constant Value Description
'vbOKOnly 0 Display OK button only.
'vbOKCancel 1 Display OK and Cancel buttons.
'vbAbortRetryIgnore 2 Display Abort, Retry, and Ignore buttons.
'vbYesNoCancel 3 Display Yes, No, and Cancel buttons.
'vbYesNo 4 Display Yes and No buttons.
'vbRetryCancel 5 Display Retry and Cancel buttons.
'vbCritical 16 Display Critical Message icon.
'vbQuestion 32 Display Warning Query icon.
'vbExclamation 48 Display Warning Message icon.
'vbInformation 64 Display Information Message icon.
'vbDefaultButton1 0 First button is default.
'vbDefaultButton2 256 Second button is default.
'vbDefaultButton3 512 Third button is default.
'vbDefaultButton4 768 Fourth button is default.
'vbApplicationModal 0 Application modal; the user must respond to the message box before continuing work in the current application.
'vbSystemModal 4096 System modal; all applications are suspended until the user responds to the message box.
'The first group of values (0–5) describes the number and type of buttons displayed in the dialog box;
'the second group (16, 32, 48, 64) describes the icon style;
'the third group (0, 256, 512, 768) determines which button is the default;
'and the fourth group (0, 4096) determines the modality of the message box.
'When adding numbers to create a final value for the argument buttons, use only one number from each group.
'The MsgBox function has the following return values:
'Constant Value Button
'vbOK 1 OK
'vbCancel 2 Cancel
'vbAbort 3 Abort
'vbRetry 4 Retry
'vbIgnore 5 Ignore
'vbYes 6 Yes
'vbNo 7 No
Public Declare Function MessageBox Lib "user32" Alias "MessageBoxA" (ByVal hwnd As Long, ByVal lpText As String, ByVal lpCaption As String, ByVal wType As Long) As Long
Public Declare Function GetActiveWindow Lib "user32" () As Long
Public Declare Function SendDlgItemMessage Lib "USER32.DLL" Alias "SendDlgItemMessageA" (ByVal hDlg As Long, ByVal nIDDlgItem As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
Public Const user_TEXT = &HC ' buttons
Public Const idOK = 0 'vbOK
Public Const idOKCANCEL = 1 'vbOKCancel
Public Const idCANCEL = 2 'vbCancel
Public Const idABORT = 3 'vbAbort
Public Const idRETRY = 4 'vbRetry
Public Const idIGNORE = 5 'vbIgnore
Public Const idYES = 6 'vbYes
Public Const idNO = 7 'vbNo
Public Function fTmes()
10 Const csSUBNAME As String = "fTmes"
20 SubName = csSUBNAME
30 On Error GoTo ErrorHandler
40 Dim hDlg As Long
50 hDlg = GetActiveWindow()
60 'If RET = "0" Then Stop
70 SendDlgItemMessage hDlg, idYES, user_TEXT, 0, "Da"
80 SendDlgItemMessage hDlg, idNO, user_TEXT, 0, "Nu"
90 SendDlgItemMessage hDlg, idOK, user_TEXT, 0, "TEST"
100 If RET = "1" Then
110 SendDlgItemMessage hDlg, idCANCEL, user_TEXT, 0, "Ok"
120 Else
130 SendDlgItemMessage hDlg, idCANCEL, user_TEXT, 0, "Anuleaza"
140 End If
150 SendDlgItemMessage hDlg, idIGNORE, user_TEXT, 0, "Ignora"
160 SendDlgItemMessage hDlg, idRETRY, user_TEXT, 0, "Reincearca"
170 SendDlgItemMessage hDlg, idABORT, user_TEXT, 0, "Abandoneaza"
180 Exit Function
190 ErrorHandler:
200 SubName = csSUBNAME
210 fEroare
220 MsgBox MsgErr, vbCritical, "Eroare de rulare- " & App.exeName
End Function
Public Sub MeMsg(frm As Form, xTimer As String, xMsg As String, xTitle As String, xType As Integer)
10 Const csSUBNAME As String = "MeMsg"
20 SubName = csSUBNAME
30 On Error GoTo ErrorHandler
40 Dim form_control As Control
50 For Each form_control In frm.Controls
60 If TypeOf form_control Is Timer Then
70 If form_control.Name = sTimer Then
80 form_control.Enabled = True
90 RET = MessageBox(frm.hwnd, xMsg, xTitle, xType)
100 form_control.Enabled = False
110 Exit For
120 End If
130 End If
140 Next form_control
150 Exit Sub
160 ErrorHandler:
170 SubName = csSUBNAME
180 fEroare
190 MsgBox MsgErr, vbCritical, "Eroare de rulare- " & App.exeName
End Sub
when i need to use the MsgBox i use this code
MeMsg Me, "tmes", "Do You Want this Change", "Atention", vbYesNo
and now i do something
If RET = vbYes Then ....
my issue is wend in a form i have many controls
the For-Next spent to mach time (Timer interval is set to 25, but if i increase the interval then user see how caption button in MsgBox is changed.
For this reason I create this topic
I hope no ofense nobody
-
February 2nd, 2012, 07:25 AM
#4
Re: language in MsgBox
I admire what you have done and your efforts. There is a way to change the locale ( language setting for your program ). I would do that rather, as DM advised.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|