-
February 21st, 2002, 09:09 AM
#1
Unicode in Form Titles
Hello!
Does someone know how i can get Unicode Character Strings into a Titlebar from a Form?
The Unicode-String is successfully loaded from a SQL-Database, but when i try to set the Caption of that Form like
me.caption = somestring
i receive only some "???".
I also tried to use a API-Function called "SetWindowTextW" but i only get the same result.
Would be nice if someone helps out or has an idea to try.
public Declare Function SetWindowTextW Lib "user32" (byval hwnd as Long, byval lpString as string) as Long
public Sub SetWindowText(hwnd as Long, VarStr as string)
Dim varbyte() as Byte
Dim cch as Long
If VarStr = "" then Exit Sub
cch = LenB(VarStr) + 2
ReDim varbyte(0 to cch)
CopyMemory varbyte(0), byval StrPtr(VarStr), cch
SetWindowTextW hwnd, VarPtr(varbyte(0))
Erase varbyte
End Sub
-
February 21st, 2002, 11:04 AM
#2
Re: Unicode in Form Titles
Try the StrConv function
Please rate it if it answers the question
or is useful.
'
John G
-
February 22nd, 2002, 02:00 AM
#3
Re: Unicode in Form Titles
Maybe I'm to dumb or somewhat but it wouldn't work for me. The Unicodes are all correct converted (even w/o strconv), but i still get only "???"
My intention is that the API-Function "SetWindowTextW" or VB messes with my Strings and Converts them to Question Marks. BTW when I use "normal" Characters that have been converted to Unicode (i.e. "ABC" = 65 0 66 0 67 0) the Result is correct.
Nonetheless thanks, "strconv" its another function to my abilities.
I'm still open for any Ideas.
-
February 22nd, 2002, 07:06 AM
#4
Re: Unicode in Form Titles
Declaration doesn't look right - try:
public Declare Function SetWindowTextW Lib "user32" (byval hwnd as Long, lpString as string) as Long
The reason is that when you use ByVal in an API declaration to a string parameter, VB converst it to a CSTR (null terminated ASCII) format.
HTH,
Duncan
-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com/EventVB/Overview.htm - Flatten the API learning curve
-
February 25th, 2002, 04:24 AM
#5
Re: Unicode in Form Titles
I will try another way.
Does someone know a example where a VB-Project shows Non-Ascii-Characters (i.e. Katakana, Kanji, Kyrillic, ...) in its Window Title and could provide a Download-Link.
Thanks in advance.
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
|