Feb 17th, 2007, 02:42 AM
#1
Thread Starter
Lively Member
[RESOLVED] display chinese character or image on msg box
Is it possible to display chinese character on MsgBox? I have tried to display chinese character, but it failed. I was wondering, can i display a image on the MsgBox? Is there such a thing?
thanks,
eve
Feb 17th, 2007, 03:17 AM
#2
Hyperactive Member
Re: display chinese character or image on msg box
You could make a custom message box, then yes. I do not know of any way to display images in a message box.
Feb 17th, 2007, 02:25 PM
#3
Re: display chinese character or image on msg box
display chinese character on MsgBox
You can do that by using the API MessageBoxW as it handles unicode strings. The normal msgbox on the contrary handles ANSI string...
Does this help?
VB Code:
Private Declare Function APIMsgBox _
Lib "User32" Alias "MessageBoxW" _
(Optional ByVal hWnd As Long, _
Optional ByVal Prompt As Long, _
Optional ByVal Title As String, _
Optional ByVal Buttons As Long) _
As Long
Private Sub Command1_Click()
Dim Chinesetext As String
Dim Rsp As String
'Replace "My_Chinese_Text" from where you are getting the Chinese text
Chinesetext = "My_Chinese_Text"
Rsp = APIMsgBox(Prompt:=StrPtr(Chinesetext), Buttons:=vbYesNo)
End Sub
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear :
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
Feb 17th, 2007, 02:40 PM
#4
Re: display chinese character or image on msg box
can i display a image on the MsgBox
yes you can....
Try this...
1) Create a new project
2) Create a commandbutton and in the command button, place this code...
VB Code:
Private Sub Command1_Click()
MsgBoxEx Me.hWnd, "msg text", , , 1
End Sub
3) Include this in a module...
VB Code:
Private Const MB_USERICON = &H80&
Private Type MSGBOXPARAMS
cbSize As Long
hwndOwner As Long
hInstance As Long
lpszText As String
lpszCaption As String
dwStyle As Long
lpszIcon As Long
dwContextHelpId As Long
lpfnMsgBoxCallback As Long
dwLanguageId As Long
End Type
Private Declare Function MessageBoxIndirect Lib "user32" _
Alias "MessageBoxIndirectA" _
(lpMsgBoxParams As MSGBOXPARAMS) As Long
Public Function MsgBoxEx( _
ByVal hwndOwner As Long, _
ByVal Prompt As String, _
Optional ByVal Buttons As VbMsgBoxStyle = vbOKOnly, _
Optional ByVal Title As String = vbNullString, _
Optional ByVal ResIconID As Long = -1& _
) As VbMsgBoxResult
Dim MB As MSGBOXPARAMS
With MB
.cbSize = Len(MB)
.lpszText = Prompt
.dwStyle = Buttons
If ResIconID <> -1& Then
.dwStyle = .dwStyle Or MB_USERICON
.lpszIcon = ResIconID
End If
.hInstance = App.hInstance
.hwndOwner = hwndOwner
If Len(Title) > 0 Then
.lpszCaption = Title
Else
.lpszCaption = App.Title
End If
End With
MsgBoxEx = MessageBoxIndirect(MB)
End Function
4) In the form's property select an icon for the form.
5)Compile an Exe as it will not show when the app is running in the IDE.
6)Run it
ps: This is not my code...
Hope this helps...
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear :
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
Feb 18th, 2007, 07:13 AM
#5
Thread Starter
Lively Member
Re: display chinese character or image on msg box
thanks, i will try it out later, get back to you guys, if i encounter any problem. Thanks for all your help.
-eve
Feb 18th, 2007, 09:24 PM
#6
Thread Starter
Lively Member
Re: display chinese character or image on msg box
Hi koolsid,
thanks the following works. Thanks alot
Originally Posted by
koolsid
You can do that by using the API MessageBoxW as it handles unicode strings. The normal msgbox on the contrary handles ANSI string...
Does this help?
VB Code:
Private Declare Function APIMsgBox _
Lib "User32" Alias "MessageBoxW" _
(Optional ByVal hWnd As Long, _
Optional ByVal Prompt As Long, _
Optional ByVal Title As String, _
Optional ByVal Buttons As Long) _
As Long
Private Sub Command1_Click()
Dim Chinesetext As String
Dim Rsp As String
'Replace "My_Chinese_Text" from where you are getting the Chinese text
Chinesetext = "My_Chinese_Text"
Rsp = APIMsgBox(Prompt:=StrPtr(Chinesetext), Buttons:=vbYesNo)
End Sub
Feb 21st, 2007, 02:22 AM
#7
Thread Starter
Lively Member
Re: [RESOLVED] display chinese character or image on msg box
1 more question. im trying to have a title for the msg box, but it is not display properly.
my code as follow:
mTitle = "AAA"
rsp = APIMsgBox(Prompt:=StrPtr(chMsg), Title:=mTitle, Buttons:=vbOK)
i have also try:
rsp = APIMsgBox(Prompt:=StrPtr(chMsg), Title:="AAA", Buttons:=vbOK)
both way dont work.
Feb 21st, 2007, 02:29 AM
#8
Re: [RESOLVED] display chinese character or image on msg box
hi
I tried both ways and it works....
but it is not display properly.
What does exactly get displayed?
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear :
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
Feb 22nd, 2007, 12:37 AM
#9
Thread Starter
Lively Member
Re: [RESOLVED] display chinese character or image on msg box
[]C
the 1st and 2nd is like overlapping. i try to put spaces in between the characters, but is turn out to be 3 '[]' square
Feb 22nd, 2007, 01:47 AM
#10
Re: [RESOLVED] display chinese character or image on msg box
Hmmm.... Can you upload your file?
I'll just have a quick look...
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear :
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
Feb 22nd, 2007, 03:00 AM
#11
Thread Starter
Lively Member
Re: [RESOLVED] display chinese character or image on msg box
hi,
here is the zip file. thanks
Attached Files
Last edited by fang_eve; Feb 22nd, 2007 at 04:30 AM .
Feb 22nd, 2007, 11:44 PM
#12
Thread Starter
Lively Member
Re: [RESOLVED] display chinese character or image on msg box
i have solve the problem. thanks koolsid
my solution:
Public Declare Function APIMsgBox Lib "User32" Alias "MessageBoxW" (Optional ByVal hWnd As Long, Optional ByVal Prompt As Long, Optional ByVal Caption As Long, Optional ByVal Buttons As Long) As Long
rsp = APIMsgBox(Prompt:=StrPtr(chMsg), Caption:=StrPtr("SDC"), Buttons:=vbOKOnly)
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