Results 1 to 7 of 7

Thread: convert to vb6

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2008
    Posts
    251

    convert to vb6

    hi every one how can i convert this code to vb6 is there a software do the conversion



    Code:
    void ArabicReverse(CString &s)
    {
        CString out, rev;
        s.MakeReverse();
    
        int i=0;
        while(i<s.GetLength())
        {
            if((s[i]>='0' && s[i]<='9'))    // isDigit(s[i]) ?
            {
                rev.Empty();
                while((s[i]>='0' && s[i]<='9'))    // isDigit(s[i]) ?
                {
                    rev = rev + s[i];
                    ++i;
                }
                rev.MakeReverse();
                out = out + rev;
            }
            else
            {
                out = out + s[i];
                ++i;
            }
        }
        s=out;
    }
    
    
    CString Arabize (LPCTSTR in)
    {
        static struct
        {
            WCHAR character;
            WCHAR endGlyph;
            WCHAR iniGlyph;
            WCHAR midGlyph;
            WCHAR isoGlyph;
        }a[N_DISTINCT_CHARACTERS]=
        {
            {0x630, 0xfeac, 0xfeab, 0xfeac, 0xfeab},
            {0x62f, 0xfeaa, 0xfea9, 0xfeaa, 0xfea9},
            {0x62c, 0xfe9e, 0xfe9f, 0xfea0, 0xfe9d},
            {0x62d, 0xfea2, 0xfea3, 0xfea4, 0xfea1},
            {0x62e, 0xfea6, 0xfea7, 0xfea8, 0xfea5},
            {0x647, 0xfeea, 0xfeeb, 0xfeec, 0xfee9},
            {0x639, 0xfeca, 0xfecb, 0xfecc, 0xfec9},
            {0x63a, 0xfece, 0xfecf, 0xfed0, 0xfecd},
            {0x641, 0xfed2, 0xfed3, 0xfed4, 0xfed1},
            {0x642, 0xfed6, 0xfed7, 0xfed8, 0xfed5},
            {0x62b, 0xfe9a, 0xfe9b, 0xfe9c, 0xfe99},
            {0x635, 0xfeba, 0xfebb, 0xfebc, 0xfeb9},
            {0x636, 0xfebe, 0xfebf, 0xfec0, 0xfebd},
            {0x637, 0xfec2, 0xfec3, 0xfec4, 0xfec1},
            {0x643, 0xfeda, 0xfedb, 0xfedc, 0xfed9},
            {0x645, 0xfee2, 0xfee3, 0xfee4, 0xfee1},
            {0x646, 0xfee6, 0xfee7, 0xfee8, 0xfee5},
            {0x62a, 0xfe96, 0xfe97, 0xfe98, 0xfe95},
            {0x627, 0xfe8e, 0xfe8d, 0xfe8e, 0xfe8d},
            {0x644, 0xfede, 0xfedf, 0xfee0, 0xfedd},
            {0x628, 0xfe90, 0xfe91, 0xfe92, 0xfe8f},
            {0x64a, 0xfef2, 0xfef3, 0xfef4, 0xfef1},
            {0x633, 0xfeb2, 0xfeb3, 0xfeb4, 0xfeb1},
            {0x634, 0xfeb6, 0xfeb7, 0xfeb8, 0xfeb5},
            {0x638, 0xfec6, 0xfec7, 0xfec8, 0xfec5},
            {0x632, 0xfeb0, 0xfeaf, 0xfeb0, 0xfeaf},
            {0x648, 0xfeee, 0xfeed, 0xfeee, 0xfeed},
            {0x629, 0xfe94, 0xfe93, 0xfe93, 0xfe93},
            {0x649, 0xfef0, 0xfeef, 0xfef0, 0xfeef},
            {0x631, 0xfeae, 0xfead, 0xfeae, 0xfead},
            {0x624, 0xfe86, 0xfe85, 0xfe86, 0xfe85},
            {0x621, 0xfe80, 0xfe80, 0xfe80, 0xfe7f},
            {0x626, 0xfe8a, 0xfe8b, 0xfe8c, 0xfe89},
            {0x623, 0xfe84, 0xfe83, 0xfe84, 0xfe83},
            {0x622, 0xfe82, 0xfe81, 0xfe82, 0xfe81},
            {0x625, 0xfe88, 0xfe87, 0xfe88, 0xfe87}
        };
        BOOL linkBefore, linkAfter;
        CString out;
        out=in;
        for(UINT i=0; i<_tcslen(in); i++)
        {
            WCHAR ch=in[i];
            if(((ch>=0x0621 && ch<=0x064a)) // is an Arabic character?
            {
                int idx = 0;
                while (idx < N_DISTINCT_CHARACTERS)
                {
                    if (a[idx].character == in[i])
                        break;
                    ++idx;
                }
                
                if(i == _tcslen(in) - 1)
                    linkAfter=0;
                else
                    linkAfter = (isFromTheSet1(in[i+1]) || 
                                       isFromTheSet2(in[i+1]));
                if(i == 0)
                    linkBefore=0;
                else
                    linkBefore=isFromTheSet1(in[i-1]);
        
                if(linkBefore && linkAfter)
                    out.SetAt(i, a[idx].midGlyph);
                if(linkBefore && !linkAfter)
                    out.SetAt(i, a[idx].endGlyph);
                if(!linkBefore && linkAfter)
                    out.SetAt(i, a[idx].iniGlyph);
                if(!linkBefore && !linkAfter)
                    out.SetAt(i, a[idx].glyph);
            }
        }
        ArabicReverse (out);
        return out;
    }
    //////////////////////////////////////////////////////////////////////
    BOOL BzArabicRender::isFromTheSet1(WCHAR ch)
    {
        static WCHAR theSet1[22]={
            0x62c, 0x62d, 0x62e, 0x647, 0x639, 0x63a, 0x641, 0x642,
            0x62b, 0x635, 0x636, 0x637, 0x643, 0x645, 0x646, 0x62a,
            0x644, 0x628, 0x64a, 0x633, 0x634, 0x638};
        int i = 0;
        while (i < 22)
        {
            if(ch == theSet1[i])
                return TRUE;
            ++i;
        }
        return FALSE;
    }
    //////////////////////////////////////////////////////////////////////
    BOOL BzArabicRender::isFromTheSet2(WCHAR ch)
    {
        static WCHAR theSet2[12]={
            0x627, 0x623, 0x625, 0x622, 0x62f, 0x630, 0x631, 0x632,
            0x648, 0x624, 0x629, 0x649};
        int i = 0;
        while (i < 12)
        {
            if(ch == theSet2[i])
                return TRUE;
            ++i;
        }
        return FALSE;
    }

  2. #2
    Addicted Member
    Join Date
    Feb 2008
    Location
    XP & Vista
    Posts
    181

    Re: convert to vb6

    I don't think so any s/f available(though not sure), you need to convert manuvally
    _____________________________________________
    Regrads,
    kpmsivachand

    Don't walk in front of me, I may not follow; Don't walk behind me, I may not lead;
    Walk beside me, and just be my friend.

    Need Reviews: 1. PDF Split, PDF Merge, PDF Encrypt, PDF Decrypt and PDF Watermark

    Need Reviews: 2. Folder Locker | Lock Folder | File Locker | Locker | Encrryption | Encrypt

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Oct 2008
    Posts
    251

    Re: convert to vb6

    Could someone help me to convert this code to vb manually or just a brief
    explanation what I need in a vb project to get same result as the code I posted

  4. #4
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: convert to vb6

    Sorry didn't understand what the code is trying to do Not sure which language is that...

    What exactly do you want to do?
    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

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Oct 2008
    Posts
    251

    Re: convert to vb6

    vb Code:
    1. Private Sub Text1_KeyPress(KeyAscii As Integer)
    2. If KeyAscii = vbKeyBack Then
    3. Text1.Text = Right(Text1.Text, Len(Text1.Text) - 1)
    4. End If
    5. End Sub
    6.  
    7. Private Sub Text1_Change()
    8. Dim intChars(20) As Integer
    9. Dim intChars1(20) As Integer
    10. Dim x, y As Integer
    11. intChars(0) = "98"
    12. intChars(1) = "66"
    13. intChars(2) = "75"
    14. intChars(3) = "122"
    15.  
    16. intChars1(0) = "97"
    17. intChars1(1) = "66"
    18. intChars1(2) = "75"
    19. intChars1(3) = "122"
    20.  
    21. For x = 0 To UBound(intChars1)
    22. If Right(Left(Text1.Text, 2), 1) = Chr(intChars(x)) Then
    23. For y = 0 To UBound(intChars)
    24. If Left(Text1.Text, 1) = Chr(intChars1(x)) Then
    25. Text1.Text = Chr(231) & Chr(229) & Right(Text1.Text, Len(Text1.Text) - 2)
    26.  
    27. End If
    28. Next
    29. End If
    30. Text1.SelStart = 0
    31. Next
    32. End Sub
    Here is my code above works great replaces anything you type in a text box if it matches those in arrays
    Then changes them to
    vb Code:
    1. Text1.Text = Chr(231) & Chr(229) & Right(Text1.Text, Len(Text1.Text) - 2)
    2. Now instead of statically changing Text1.Text = Char(231) & Chr(229)

    Dynamically changing them
    Now to achieve Bidirectional

    Need to link ASCII in variables together
    Like this for example
    vb Code:
    1. intChars(0) = "98" link intChars1(0) = "97"
    2. intChars(1) = "66" link intChars1(1) = "66"
    3. intChars(2) = "75" link intChars1(2) = "75"
    4. intChars(3) = "122" link intChars1(3) = "122"
    5. so on
    6.  
    7. intChars1(0) = "97" link intChars(0) = "98"
    8. intChars1(1) = "66" link intChars(1) = "66"
    9. intChars1(2) = "75" link intChars(2) = "75"
    10. intChars1(3) = "122" link intChars(3) = "122"
    If 2 ASCII are in variables then replace them with its link
    so when ascii entered in text if left 97 and right 66 then changes them to its link
    vb Code:
    1. Text1.Text = Chr(link intChars1(0) = "97") & Chr(link intChars1(0) = "66") & Right(Text1.Text, Len(Text1.Text) - 2)
    Last edited by bordino; Yesterday at 02:46 PM.
    bordino is offline Rate this post
    Add to bordino's Reputation Report Post Reply With Quote
    Last edited by Hack; Jan 4th, 2010 at 07:23 AM.

  6. #6
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: convert to vb6

    Bordino, sorry , I am lost... could you explain in simple words what exactly do you want?

    Also when posting codes, please use code tags so that they are easy to understand...
    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

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Oct 2008
    Posts
    251

    Re: convert to vb6

    simply convert unicode to ascii manually as you type in text box

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width