|
-
Jul 12th, 2000, 05:53 AM
#1
Thread Starter
New Member
I've written a small Word97 macro that supports the Right-Left direction of writing Arabic characters in the standard Win95/98 environment (i.e not Arabic windows). Characters are entered either via a virtual keyboard or a hidden textbox and reproduced on the document using wordbasic's "selection.typetext" command. It supports any fonts with Unicode Arabic characterset (U+0600-U+06FF, U+FB50-U+FDFF & U+FE70-U+FEFF)
As far as word97 is concerned, this macro satisfies my needs. The problem arises when I decided to port this macro to the standard VBasic (I've installed VB6 Ent Ed). The "ChrW" command that works in Word97 doesnt really work in VB.
For example in Wordbasic the statement:
(Assuming the font used has Arabic charset)
TextBox1.Text=ChrW(&HFEED) ---> gives you the Arabic "Wau"
If this is written in VB:
Text1.Text=ChrW(&HFEED) ---> gives you a "?"
How can I resolve this problem?
I plan to come up with a stand alone simple editor (along the line of Window's notepad) that supports R-L Arabic writing.
Helps appreciated.
-
Jul 12th, 2000, 06:11 AM
#2
Lively Member
hiya,
Look up the usage or StrPtr... its an undocumented VB functions that does what u want. It is undocumented but MSDN explains its usage pretty succintly 
Cheers
Gaurav
[email protected]
" Programming today is a race between software-engineers striving to build bigger and
better idiot-proof programs and the universe trying to produce bigger and better idiots.
So far the universe is winning". :-)
-
Jul 13th, 2000, 11:30 PM
#3
Thread Starter
New Member
Hi Gaurav,
You said:
Look up the usage or StrPtr... its an undocumented VB functions that does what u want. It is undocumented but MSDN explains its usage pretty succintly 
I did that and searched for anything on ChrW(), Chr(), StrPtr and VarPtr in MSDN. I read an article written by Steven Roman (cant remember the URL). But they all led me to nowhere.
BTW, ChrW(x) function is supposed to take a long value of x in the range 0 - 65535. This is supposed to return you with the Unicode character of x. From what I have tested,this statement is only true if x is between 32 to 255. Beyond these, VB will give you something else.
Assuming that you have IE5.0 with multilinggual support, your Arial font will surely have, say, Arabic digit One (Unicode H661). With the understanding that ChrW(x) will retrun the unicode character of x, then ChrW(&H661) should give you the Arabic Digit 1.
In WordBasic, ChrW(&H661) will register correctly but not in VB (in VB6 you get a question mark).
Consider the following:
Print AscW(ChrW(65)) ---> 65
Print AscW(ChrW(&H661)) ---> 1633
and supprise suprise
Print AscW(ChrW(&H7eee)) ---> 32494
Print AscW(ChrW(&H8000)) ---> -32768
Anybody can tell how this is so?
My peabrain logic tells me AscW(ChrW(&H8000) should be ---> 32495. Otherwise there will be no truth in ChrW(x) will take x=1 - 65535 and giving you character x in Unicode encoding.
Megatron, Ultimus Prime, whoever pls help.
-
Jul 14th, 2000, 12:53 AM
#4
Lively Member
In VB &h???? return an integer
Use &h????& to return a long
Then in VB &h8000 = -32768
and &h8000& = 32768
-
Jul 14th, 2000, 01:31 AM
#5
Thread Starter
New Member
Right, I've tried that. Send that to text box:
AscW(ChrW(&H8000&)) ----> -32768
I'm expecting something like AscW(ChrW(&H8000)) ---> 32768 because AscW(ChrW(&H7FFF)) ---> 32767
[Edited by Irshah on 07-14-2000 at 02:42 AM]
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
|