Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

VBÖеÄUnicode ºÍ Ansi ¸ñʽ ת»»


 VBÖеÄUnicode ºÍ Ansi ¸ñʽ
    Visual Basic 32-bit °æ±¾µÄ×Ö´®´¦Àí²ÉÓà Unicode£¬Ò²¾ÍÊÇ˵×Ö´®ÔÚ VB ÄÚ²¿ÊÇÒÔUnicode µÄ¸ñʽÀ´´æ·Å¡£ºÎν Unicode£¿¼òµ¥µÄ˵£¬¾ÍÊÇÿһ¸ö×Ö·û¶¼ÊÇÒÔ 2-byte µÄÐÎʽ±íʾ£¬¶øÿ¸ö¡¸ÊµÌå×Ö·û¡¹¾ÍÊÇÒ»¸ö¡¸×Ö·û¡¹¡£Òò´Ë£¬
 Len("´ó¼ÒºÃ")
 Len("abc")
    Ëù·µ»ØµÄÖµ¶¼ÊÇ 3£¬ÒòΪ¡¸´ó¡¹ºÍ¡¸a¡¹¶¼ÊÇÒ»¸ö×Ö·û¡£
    µ«ÊÇÕâ¶ÔһЩÖÐÎÄ×Ö´®´¦Àí£¬ÀýÈç´¿ÎÄ×ÖµÄÊý¾ÝÎļþ£¬È´ÊÇÒ»¸ö´óÔÖÄÑ£¬ÒòΪÄã±ØÐëÒÔbyte À´¶¨Î»Ã¿¸ö×Ö·û£¬¿ÉÊÇ Unicode È´°ÑÒ»ÇеĴ¦ÀíÈ«¸ãÔÒÁË¡£ÀýÈ磺
Len("Good Morning") ·µ»Ø 12£¬¶ø 
Len("½ñÌìÌìÆøºÜºÃ") ·µ»Ø 6 
    ¶Ô³õѧÕ߶øÑÔ£¬ºÃ²»ÈÝÒ×ÄÜʹÓà VB À´Ð´³ÌÐòÒѾ­ÊǼþÁ˲»ÆðµÄÊÂÁË£¬È´ÂíÉÏÔÚÖÐÎÄ´¦ÀíÉÏ°¤ÁËÒ»¼ÇÃƹ÷£¬ËùÊܵ½µÄ´ò»÷ʵÔÚ²»Ð¡¡£µ«ÊDz»ÒªÅ£¬ÊÂʵÉÏÖ»ÒªÔÙ¶àÁ˽âһЩָÁ¾Í¿ÉÒÔ°ÑÖÐÎÄ´¦ÀíµÄÎÊÌâ½â¾öÁË¡£
    ÊÇʲôָÁîÄØ£¿×îÖØÒªµÄĪ¹ýÓÚ StrConv ÁË¡£StrConv º¯ÊýµÄÓ﷨Ϊ£ºStrConv(´ýת»»×Ö´®, ת»»¸ñʽ)
     ÆäÖÐת»»¸ñʽÔÚÕâÀïÓõ½µÄÊÇ£º
    vbUnicode ½« Ansi ×Ö´®×ª»»Îª Unicode
    vbfromUnicode ½« Unicode ×Ö´®×ª»»Îª Ansi
    ½«×Ö´®×ª³É Ansi Ö®ºó£¬ËùÓеÄ×Ö´®´¦ÀíÖ¸ÁҪ¼Ó¸ö B£¬ÀýÈ磺LeftB, RightB,
    MidB, ChrB, InstrB, LenB, InputB µÈ¡£ÀýÓÃÕâЩָÁîÀ´´¦Àí¾ÍÐÐÁË¡£
    µ±Äã´¦ÀíÍê±ÏÖ®ºó£¬Äã¿ÉÒÔÔÙ½«ËüÔÙת»Ø Unicode£¬ÕâÑù¾Í¿ÉÒÔʹÓÃÒ»°ãµÄ×Ö´®´¦ÀíÖ¸ÁîÁË¡£ÕâÑù½²¿´µÃ¶®Âð£¿Èç¹û»¹ÊDz»Á˽⣬¿´¿´ÏÂÃæµÄʵÀý˵Ã÷£º
¼òÒ×ʹÓ÷¶Àý
¿´¿´ÏÂÃæµÄ»ù±¾·¶ÀýÄúÓ¦¸Ã¾Í»á¶Ô VB µÄ×Ö´®´¦Àí·½Ê½ÓÐЩ¸ÅÄî¡£
Private Sub Command1_Click ()
Dim sUnicode As String
Dim sAnsi As String
' Unicode ÔËËã
sUnicode = "ÍõСÃ÷,A123456789,651023,ÉϺ£ÊÐÖÐɽ·100ºÅ,(02)2345678"
Debug.Print Len(sUnicode) ' ·µ»Ø 44
Debug.Print Mid$(sUnicode, 5, 10) ' ·µ»Ø A123456789
Debug.Print Instr(sUnicode, "ÉϺ£ÊÐ") ' ·µ»Ø 23
' ½« Unicode ×Ö´®×ª³É Ansi
sAnsi = StrConv(sUnicode, vbfromUnicode)
' Ansi ÔËËã
Debug.Print LenB(sAnsi) ' ·µ»Ø 54
Debug.Print MidB$(sAnsi, 8, 10) ' ·µ»Ø ?????£¬ÒòΪÍüÁËת»Ø Unicode
Debug


Ïà¹ØÎĵµ£º

ÓÃVB Winsock¿Ø¼þ´´½¨TCP/IP¿Í»§»ú/·þÎñÆ÷³ÌÐò


ת×Ô£ºhttp://www.52arm.com/Article_Show.asp?ArticleID=186
 
×÷Õߣºweidian    ---±¾Õ¾Ô­´´    µã»÷Êý£º4721    ·¢±íʱ¼ä£º2008-5-7    ±à¼­£ºsanzang
 
Winsock¿Ø¼þ½¨Á¢ÔÚTCP¡¢UDPЭÒéµÄ»ù´¡ÉÏ£¬Íê³ÉÓëÔ¶³Ì¼ÆËã»úµÄ ......

VB ×ÊÁϵ¼³ö

Ôںܶà VB µÄ×ÊÁÏ¿âÊé¼®ÖУ¬¶¼»áºÜÍêÕûµÄÌáµ½£ºÈçºÎÓÉÆäËûÖÖÀàµÄÎļþÖн«×ÊÁϵ¼Èë×ÊÁϿ⣬µ«ÊÇÈ´ºÜÉÙÓÐÊéÌáµ½£ºÈçºÎ½«×ÊÁÏ¿âÖеÄ×ÊÁÏ£¬µ¼³öµ½¸÷ÖÖ²»Í¬µÄÎļþÀàÐ͵ÄÎļþÖУ¬Á¬ VB µÄ Help ÖÐÒ²ÊÇÕâÑù£¡
»òÐíÊÇ´ó¼Ò¶¼ÈÏΪ×ÊÁÏ¿âÖ÷ÌâµÄÖصãÊÇÔÚ×ÊÁÏ¿â±¾Éí°É£¡
µ«ÊÇ£¬ÔÚʵ¼ÊµÄ×ÊÁÏ¿â³ÌÐòÔËÓÃÖУ¬È´³£³£ÐèÒª½«×ÊÁÏ¿âµ¼³öµ½¸÷ÖÖ ......

vb×Ô¶¯¹Ø»ú³ÌÐò

Private Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long
Private Const EWX_LOGOFF = 0
Private Const EWX_SHUTDOWN = 1
Private Const EWX_REBOOT = 2
Private Const EWX_FORCE = 4
Private closeTime As String
Sub AdjustTokenPrivilegesForNT()
  ......

VBÓëWindows API½²×ù(¶þ) өĻץȡÓëÓ©Ä»±£»¤³Ìʽ

ÎÄÕÂÀ´Ô´:vb´óÊÀ½ç ×÷ÕߣºÍõ¹úÈÙ
¡¸VB ûÓÐÌṩÕâÑùµÄ¹¦ÄÜ£¬ ±ØÐëºô½Ð Windows API¡¹£¬ µ±±ÊÕßÕâÑù»Ø´ð¶ÁÕßÖ®áᣬÓÐЩ¶ÁÕß»áÒªÇó±ÊÕß½éÉÜ Windows API ·½ÃæµÄÊé¼®£¬ ÓÈÆäÊÇÖÐÎÄÊ飬 µ«Êµ¼ÊÉÏ£¬Ä¿Ç°ÊÐÃæÉÏÖ»¿´µ½Ò»±¾Ô­ÎÄÊé(ZD Press ³ö°æµÄ Visual Basic 5.0 Programming Guide to Win32 API)£¬ ÖÐÎÄÊéÔòδ¼û¹ý£¬ Ϊʲ÷áÃ»Ó ......

VBÎÞËù²»ÄÜÖ®Áù£º¶Ô³ÌÐòÔËÐеļà¿Ø ת

×÷Õß: ØýÃû, ¡¡³ö´¦:ITר¼ÒÍø,¡¡ÔðÈα༭: лåûåû,¡¡
2010-04-23 11:20
¡¡¡¡±¾ÎĽéÉÜVB¶Ô³ÌÐòÔËÐеļà¿Ø¡£
¡¡¡¡×ªÑۼ䣬±¾ÏµÁÐÎÄÕÂÒѾ­Ð´µ½Á˵ÚÁù¸ö£¬½ñÌìдµãʲôÄØ?
¡¡¡¡»¹ÊǵÃд£¬¿´ËÆVB×ö²»µ½µÄÊÂÇ飬ÄÇô½ñÌìÆð¾ÍддVB¶Ô²Ù×÷ϵͳµÄ¿ØÖÆ°É¡£
¡¡¡¡Ê×ÏÈ£¬ËµÒ»Ëµ£¬VB¶ÔÓÚ±»µ÷ÓúóµÄ³ÌÐòµÄ¼à¿Ø·½·¨¡£
¡¡¡¡Ô­Ðͺ¯Êý¼ò ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ